box detection/rectangle detection

11 views (last 30 days)
Hi
Here is my sample image. How to automatically grab/crop/know the region of each colour square without using 'get rect' function?

Accepted Answer

Image Analyst
Image Analyst on 24 Nov 2021
There is a function for this: colorChecker()
Attached is a full demo.
  5 Comments
Salad Box
Salad Box on 2 Dec 2021
Thank you! I am taking a deep breath. Colour science seems so hard core and tutorial like this is exactly what I needed.
I am really keen to go for this 8-hour course in colour science taught by you if it can be accessed in any ways?
Please advise.:)
Roger Breton
Roger Breton on 30 Jan 2024
I tried your "Test.m" code and still got the same error message: "Color patches were not detected."?
% Read in image that has a Color Checker chart in it but that has unknown image capture conditions.
% fileName = 'colorCheckerTestImage.jpg';
fileName = 'CC24 in Scene JPEG.jpg';
rgbImage = imread(fileName);

Sign in to comment.

More Answers (1)

yanqi liu
yanqi liu on 25 Nov 2021
yes,sir,use Image Analyst suggest method,can get
clc; clear all; close all;
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/812319/image.jpeg';
img = imread(filename);
% use colorChecker
chart = colorChecker(img);
displayChart(chart)
% use measureColor
[colorTable, ccm] = measureColor(chart);
figure;
displayColorPatch(colorTable); set(gcf, 'units','normalized','position',[0,0,1,1])
colorTable
colorTable = 24×9 table
ROI Color Measured_R Measured_G Measured_B Reference_L Reference_a Reference_b Delta_E ___ ________________ __________ __________ __________ ___________ ___________ ___________ _______ 1 {'DarkSkin' } 115 63 42 37.54 14.37 14.92 11.905 2 {'LightSkin' } 248 171 155 64.66 19.27 17.5 15.464 3 {'BlueSky' } 71 109 182 49.32 -3.82 -22.54 22.639 4 {'Foliage' } 54 90 44 43.46 -12.74 22.72 12.144 5 {'BlueFlower' } 133 119 181 54.94 9.61 -24.79 9.0919 6 {'BluishGreen' } 69 193 191 70.48 -32.26 -0.37 9.8937 7 {'Orange' } 247 141 31 62.73 35.83 56.5 14.512 8 {'PurplishBlue'} 68 76 160 39.43 10.75 -45.17 7.7894 9 {'ModerateRed' } 240 84 96 50.57 48.64 16.67 18.741 10 {'Purple' } 73 34 97 30.1 22.54 -20.87 13.951 11 {'YellowGreen' } 154 202 60 71.77 -24.13 58.19 9.0499 12 {'OrangeYellow'} 254 182 19 71.51 18.24 67.37 14.268 13 {'Blue' } 46 52 148 28.37 15.42 -49.8 9.7419 14 {'Green' } 17 166 74 54.38 -39.72 32.27 14.419 15 {'Red' } 221 54 37 42.43 51.05 28.62 26.85 16 {'Yellow' } 253 238 22 81.8 2.67 80.41 17.854
  1 Comment
Salad Box
Salad Box on 29 Nov 2021
Thank you so much for confirming and explaning this! Very very useful!!

Sign in to comment.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!