What's wrong with my feature extraction code?

I am getting same descriptors for different images.
I tested it by:
image1 = imread('C:\Users\Explorer\Documents\MATLAB\ASL_signs\A.jpg');
image2 = imread('C:\Users\Explorer\Documents\MATLAB\ASL_signs\B.jpg');
v1=Descrip(image1);
v2=Descrip(image2);
SUM=sum(v1-v2)
_____________________________________________________________________________________
Output :
SUM =
0

1 件のコメント

Explorer
Explorer 2014 年 2 月 12 日
There is something wrong in Descrip.m because I am getting zero for SUM=sum(v1-v2). Ideally, it should not be zero.

回答 (2 件)

David Young
David Young 2014 年 2 月 12 日

0 投票

Descrip writes then reads contour.jpg, and then computes the result from that. One way to set about debugging would be to see whether contour.jpg is different for the two images. That will help pin down where the problem lies.

4 件のコメント

Explorer
Explorer 2014 年 2 月 12 日
編集済み: Explorer 2014 年 2 月 12 日
How can I program it to save figure with different name whenever I run it?
Explorer
Explorer 2014 年 2 月 12 日
I created another function having name "Descrip2.m" in which image will be saved with contour2.jpg
And tested again by
image1 = imread('C:\Users\Explorer\Documents\MATLAB\ASL_signs\A.jpg');
image2 = imread('C:\Users\Explorer\Documents\MATLAB\ASL_signs\B.jpg');
v1=Descrip(image1);
v2=Descrip2(image2);
SUM=sum(v1-v2)
__________________________________________________________________________________
Output:
SUM =
0
____________________________________________________________________________
Still I am getting sum as zero.
Explorer
Explorer 2014 年 2 月 12 日
編集済み: Explorer 2014 年 2 月 12 日
But sum is not equal to equal when I replace "1" with "2" in line # 57 of Descrip.m and Descrip2.m
i.e
________________________________________________________________________
Original
thisBoundary = boundary{1}; % Or whatever blob you want.
________________________________________________________________________
Replaced
thisBoundary = boundary{2}; % Or whatever blob you want.
David Young
David Young 2014 年 2 月 13 日
The idea was that you run Descrip with one input image, look at contour.jpg, run it again with the other input image, and look at contour.jpg again. Are they different?
Image Analyst
Image Analyst 2014 年 2 月 12 日
編集済み: Image Analyst 2014 年 2 月 12 日

0 投票

Don't use image as a variable name - it's the name of a built-in function.

5 件のコメント

Explorer
Explorer 2014 年 2 月 13 日
I have renamed it but still there occur same problem.
Image Analyst
Image Analyst 2014 年 2 月 13 日
編集済み: Image Analyst 2014 年 2 月 13 日
What are you using now: Descrip or Descrip2? Doesn't stepping through it with the debugger reveal where the problem is????
Explorer
Explorer 2014 年 2 月 13 日
編集済み: Explorer 2014 年 2 月 13 日
image1 = imread('C:\Users\Explorer\Documents\MATLAB\ASL_signs\A.jpg');
image2 = imread('C:\Users\Explorer\Documents\MATLAB\ASL_signs\B.jpg');
v1=Descrip(image1);
v2=Descrip(image2);
SUM=sum(v1-v2)
___________________________________________________________________________________
Output :
SUM =
0
_____________________________________________________________________
I think sum should not be zero here. Don't you think so?
Image Analyst
Image Analyst 2014 年 2 月 13 日
If image A equals image B then I think they should be the same. You didn't attach either image so only you can know that. What did stepping through with the debugger reveal to you?
Walter Roberson
Walter Roberson 2014 年 2 月 13 日
Watch out for the case where v1 and v2 are being returned as unsigned integers; in that case if v2 > v1 you would get "clipping" at 0 instead of getting a negative number.

この質問は閉じられています。

質問済み:

2014 年 2 月 12 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by