How do i generate hash value from an image file ?
21 次查看(过去 30 天)
显示 更早的评论
Hi, I'm writing a project which involves the generation of MD5 Hash values from an image, i have analysed the image using MATLAB. I have also gotten to the point of finding a ROI (Region of Interest) but i dont know how i can be able to generate hash values from there.
Please any help will be appreciated.
this is the code i have so far..
clear all;
k=input ('Enter the file name:' , 's');
I = imread(k);
background = imopen(I,strel('disk',15));
figure, surf(double(background(1:8:end,1:8:end))),zlim([0 255]);
set(gca,'ydir','reverse');
I2 = I - background;
I3 = imadjust(I2);
level = graythresh(I3);
bw = im2bw(I3,level);
bw = bwareaopen(bw, 50);
I4 = imshow(I);
e = imellipse(gca,[65 109 48 48]);
BW = createMask(e,I4);
img = double(I4);
[SP_POINTS] = MakeFeatures(img);
%Show feature points
out = 1- SP_POINTS;
out = im2uint8(out);
hashVec = createstruct(out);
figure, imshow(I);
figure, imshow(I2);
figure, imshow(I3);
figure, imshow(bw);
cc = bwconncomp(bw, 4)
cc.NumObjects
1 个评论
Institute Jassim
2012-8-24
Hi Freind, I am wotking on the watermarking by using wavelet algorith. I need to create a hash function in matlab language for an image in order to embed it as a watermark.
回答(3 个)
Walter Roberson
2011-3-17
imshow() returns the handle-graphics handle to the image object created in the tool figure. A handle-graphics handle is already of class double, so I am having difficulty figuring out what you are expecting your line
img = double(I4);
to do ?
MakeFeatures does not appear to be a Mathworks routine, and createstruct() does not appear to be either.
If you were to use
roiPixels = I(repmat(logical(BW),1,1,size(I,3)));
then that would extract the pixel values only at the masked locations. Be careful, though: if your original image is RGB then all of the information for R would appear before all of the information for G which in turn would appear before all of the information for B.
0 个评论
shivu P
2018-3-23
编辑:Walter Roberson
2018-3-26
Enter the file name:c.jpg
Undefined function 'MakeFeatures' for input arguments of type 'double'.
Error in MD5 (line 25) [SP_POINTS] = MakeFeatures(img); >> >>
I am getting this error after executing this code..........any help to resole this would be more appreciable
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!