How to use RGB transformation in to HSV and extract different layers and proccess it?

11 次查看(过去 30 天)
My task will be to map the intensity from the RGB model to the HSV model, where I will perform filtering. Then map the resulting image back to the RGB model.
Any tips or recommendation where I have to start and where I have to be careful in doing it.
I have the jpeg image which is 612 × 408 ×3, first i need to normalize image in to interval from 0-1, then use transformation function whit following parameteres: vi = max(ri , gi , bi) ci = max(ri , gi , bi) − min(ri , gi , bi) li = vi − ci 2 hi = 60deg · ( gi−bi ci ), vi = ri 60deg · (2 + bi−ri ci ), vi = gi 60deg · (4 + ri−gi ci ), vi = bi 0, ci = 0. (redi, greeni, bluei).
In the 3. part in need fold model in to proper fit:
The obtained values ​​of 'hi' , 'si' , 'vi' , which make up the HSV record (hue, saturation and value), fold in an array of the same size as the input RGB image so that each image element will have (xi , yi) values ​​(hi , si , vi).
Thank you.

采纳的回答

Image Analyst
Image Analyst 2022-8-15
Use the built-in functions rgb2hsv and hsv2rgb
hsvImage = rgb2hsv(rgbImage);
[hi, si, vi] = imsplit(hsvImage);
% Then do filtering of any of them.
% Then rebuild a filtered RGB image
hsvImage = cat(3, hi, si, vi);
filteredRGBImage = hsv2rgb(hsvImage);
  6 个评论
Image Analyst
Image Analyst 2022-8-18
I'd use imsplit and cat and do the whole thing vectorized, using the whole arrays rather than a nessted for loop. And of course I'd put in tons more comments like all professional programmers should do.
I do give internal short courses occasionally as part of my job for my employer but that's not my main job.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by