Clear Filters
Clear Filters

The code I have written is not working,I think experts help me to correct and run this code.

1 view (last 30 days)
Target=cat(3,'im0040.jpg','im0052.jpg');
prompt = 'Enter the file name of the image: ';
input = input(prompt,'s');
Test=imread(input,'jpg');
Dom_Colour=DominatingColour(Test);
TestImage = imfilter(Test, fspecial('average', [3 2]));
[Corr_Coefficient,index] = CorrelationCoefficient(Target,Test,Dom_Colour);

Accepted Answer

Walter Roberson
Walter Roberson on 31 Mar 2018
>> Target=cat(3,'im0040.jpg','im0052.jpg')
1×10×2 char array
Target(:,:,1) =
'im0040.jpg'
Target(:,:,2) =
'im0052.jpg'
It is not clear to me why you would want to take the Correlation Coefficient of a 3 dimensional array of characters ?
Perhaps you were thinking of reading the files to get the content using imread().
But if so, then keep in mind that .jpg files are almost always RGB, which is 3D matrices already. If you were to cat() two of those together along the third dimension, that would fail if they were different sizes of images, but if they were the same size of image you would end up with something that was height by width by 6, which is unlikely to be what you want.
  2 Comments
Belie
Belie on 28 Apr 2018
thank You Mr.walter R..The correlation coefficient is a function which determined by the dominating colour,i will take more than three images in cat().Well Mr.Walter I don't know how I detrmine the Hsv ?
Walter Roberson
Walter Roberson on 28 Apr 2018
What is it that you think you are taking the correlation between?
I have the suspicion that you have a series of images of known color, and that you have an image to be analyzed, and that you are taking the correlation coefficient between the image to be analyzed the the various known images, and want to find the one with the highest similarity, and will then declare the color of that one with the highest similarity to be the matching color. Is that correct?

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type 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!