Compare Colors of 2 Images
古いコメントを表示
Hey,
So my problem is I have 2 samples Images like the ones attached and I want to compare the difference in color between them. How can I do it ? Is taking an average of all rgb values of each image and then subtracting them from one another give the right value ?
9 件のコメント
rushabh Doshi
2014 年 3 月 7 日
移動済み: DGM
2023 年 2 月 13 日
chinnapparaj rahul
2016 年 3 月 30 日
移動済み: DGM
2023 年 2 月 13 日
hi what is the meaning of the code g1=y1(:,:,2);
m1=g1(1,1,1);
Walter Roberson
2016 年 3 月 30 日
移動済み: DGM
2023 年 2 月 13 日
Color images are stored in 3 dimensional arrays, first the red plane then the green plane and then the blue plane -- RGB, Red Green Blue. So y1(:,:,2) is accessing the second plane, the Green plane. With the plane having been extracted, individual pixels can be examined, such as g1(1,1,1) extracting the either the "top left" or "bottom left" pixel (depending on your convention.)
Image Analyst
2016 年 3 月 30 日
移動済み: DGM
2023 年 2 月 13 日
so m1 is the red value (because the third index is 1) of the upper left pixel (in row 1, column1, which are the first 2 indexes).
Walter Roberson
2016 年 3 月 30 日
移動済み: DGM
2023 年 2 月 13 日
No, not this time. g1 is the extracted green plane, and then m1 is extracting from that plane. They coded 3 indices to index the 2D matrix, which is permitted but confusing.
Image Analyst
2016 年 3 月 30 日
移動済み: DGM
2023 年 2 月 13 日
Oh, you're right. I would have thought supplying a third index to a 2D array would have thrown an error. This also glaringly points out why I suggest descriptive variable names, like "greenChannel", rather than one or two letter names.
ardalan benam
2016 年 7 月 13 日
the best way would be to calculate the color histogram and then compare the color histograms by the the built in functions available in matlab
Walter Roberson
2016 年 7 月 14 日
ardalan benam :
No, color histograms are not adequate for recognizing mis-manufactured parts.
sateesh kumar
2018 年 6 月 7 日
Instead of RGB comparison I prefer YCbCr and HSI plane comparison for better indication of colour differed areas.
回答 (3 件)
Iain
2014 年 3 月 6 日
0 投票
I think that if you define "colour" correctly, that you will easily figure out the right measurement.
I also think that you need to take care as the cameras may differ drastically.
Image Analyst
2014 年 3 月 6 日
0 投票
You didn't attach the images. Sure, you can just take the mean RGB and compare/subtract those - that's one way. There are other ways. How you should proceed actually really depends on what kind of information you need to do what you want to do . So, unless the pictures are identical for every single pixel, there will be a difference. But how big does the difference need to be for you to take action on that knowledge? If it's only the red value of one single pixel, do you want to know that? Or will that not affect what decisions you'll make? If the images are nominally the same (same scene and field of view and the images are aligned) then you can calculate the delta E (color difference) between every single pixel. What exactly do you want to do once you know that there is a color difference? Do you want to do histogram matching?
2 件のコメント
rushabh Doshi
2014 年 3 月 7 日
Image Analyst
2014 年 3 月 7 日
That's EXACTLY why delta E was invented. It's main purpose in life is to specify color differences, especially in industrial manufacturing situations where you have to match a new batch with a standard color. Think of all the products out there that have a particular color with them: Tide orange, Coca Cola Red, Pepto Bismol pink, etc. How do you think they maintain the same color year after year despite changes in inks, dyes, and other raw materials? They use delta E. It's a very well established method.
Go here for formulas for RGB to LAB and from LAB to delta E. http://www.easyrgb.com/index.php?X=DELT Also see the delta E app in my File Exchange http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
David Setiabudi
2016 年 5 月 17 日
0 投票
Delta E is to compare one color to ANOTHER COLOR. Not one full colored image with it's colorful structure TO ANOTHER COLORFULL IMAGE............
We got the same problem... LOOKING FOR THE CMSSIM....
3 件のコメント
Walter Roberson
2016 年 5 月 17 日
That problem statement is too vague to respond to. Which of the following do you need assistance with?
- illumination correction
- image registration
- texture analysis
- Content Based Image Retrieval (CBIR)
- pattern matching
- feature extraction
- scene analysis
- stereo rectification
- logical reasoning about scenes
- gesture recognition
- emotion analysis
- bioanalytics: fingerprint, facial recognition
- motion analysis
- compressive sensing
For example, is the task statement: "Monitor this set of outdoor cameras and recognize and point out cooperative tool use by non-humans" ?
Image Analyst
2016 年 5 月 17 日
The original poster wanted to compare the color of one green part to another. In that case, getting the average CIE LAB colors of the green parts and plugging them into Delta E seems very reasonable.
Walter Roberson
2016 年 5 月 17 日
Someone wrote an entire masters thesis about CMSSIM just a few years ago. http://ethesis.nitrkl.ac.in/5761/1/212EE1388-5.pdf
カテゴリ
ヘルプ センター および File Exchange で Image Processing and Computer Vision についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
