identifying objects in a picture containing several objects

14 ビュー (過去 30 日間)
Tomescu
Tomescu 2011 年 12 月 21 日
コメント済み: Sara 2017 年 4 月 12 日
I have a picture that contains more obiecte.Obiectele I have separated into smaller pictures (cut from full size) must make a sequence of code that I find an object and make a circle around him. 10x

採用された回答

Chandra Kurniawan
Chandra Kurniawan 2011 年 12 月 21 日
Hello,
Why don't you use command 'normxcorr2' from Matlab??
Here I have a sample code :
clear; clc;
I = imread('office_5.jpg');
J = I(192:250,180:220,:);
imshow(J);
c = normxcorr2(J(:,:,1),I(:,:,1));
[max_c, imax] = max(abs(c(:)));
[ypeak, xpeak] = ind2sub(size(c),imax(1));
corr_offset = [(xpeak-size(J,2)) (ypeak-size(J,1))];
figure, imshow(I); hold on;
rectangle('position',[corr_offset(1) corr_offset(2) 50 50],...
'curvature',[1,1],'edgecolor','g','linewidth',2);
The object is :
And the correlation result is :
  3 件のコメント
Image Analyst
Image Analyst 2017 年 4 月 11 日
What are you talking about? I see no lower case j in the code.
Sara
Sara 2017 年 4 月 12 日
No sorry . i mean J at the coding above . This J = I(192:250,180:220,:); . How to get the value?

サインインしてコメントする。

その他の回答 (5 件)

Chandra Kurniawan
Chandra Kurniawan 2011 年 12 月 21 日
Just the same code.
You just need to change the I and J with your 'reference' image and the object
clear; clc;
I = imread('di-5Y01.jpg');
object = imread('di-FNMJ.jpg');
c = normxcorr2(object(:,:,1),I(:,:,1));
[max_c, imax] = max(abs(c(:)));
[ypeak, xpeak] = ind2sub(size(c),imax(1));
corr_offset = [(xpeak-size(object,2)) (ypeak-size(object,1))];
figure, imshow(I); hold on;
rectangle('position',[corr_offset(1) corr_offset(2) 30 60],...
'curvature',[1,1],'edgecolor','g','linewidth',2);
And the result :
  5 件のコメント
Arash
Arash 2012 年 7 月 9 日
Hi Chandra,
How about the objects that have some rotation, I mean consider some frames and in each frame the object has a little rotation and translation, is it possible to detect the object in all of the frames? if yes How?
Thanks in advance,
Arash
jeyshree
jeyshree 2013 年 8 月 7 日
hi, i used the above code.i downloaded an image from http://imageshack.us/photo/my-images/825/obiect10inpoza.png/ and used it instead of di-5Y01.jpg.similarly i downloaded the image in URL http://imageshack.us/photo/my-images/690/obiect5.jpg/ and used it instead of di-FNMJ.jpg.only i changed the images used.but still it is not detecting the cup from the image.what shall i do?

サインインしてコメントする。


Tomescu
Tomescu 2011 年 12 月 21 日
Thanks for the reply! I reference image that contains 10 items. I have separate objects in small images (cut from the reference image). Code sequence must find an object that you selected (if the write code sequence "object 1" must make a circle around the "object 1" If it says "Objective 2" to make the circle around the "item 2" Can you help me please? Thanks reference image
Object

Tomescu
Tomescu 2011 年 12 月 21 日
Thank you very much! It works. May I ask one more thing if you can help me. Should identify the object in a circle. Now we identify an ellipse. and not half as the reference object (ellipse is part of the object). Thank you again. http://imageshack.us/photo/my-images/825/obiect10inpoza.png/ http://imageshack.us/photo/my-images/651/obiect10.jpg/
  1 件のコメント
Image Analyst
Image Analyst 2011 年 12 月 21 日
This is not an answer. This should be a comment on someone's answer, which you did above, so you can delete this "answer" lest someone respond to it and then you mark this (your follow-up comment) as the solution.

サインインしてコメントする。


sneha
sneha 2012 年 4 月 18 日
hi....experts.....sneha here..........very amazing detection of objects.....i also worked on license plate detection of car...can u give me this type of code for detecting car license plate...please.........m waitng for reply............

Francesco Violo
Francesco Violo 2015 年 7 月 28 日
Hello, I am Francesco , for a university work let me know if you can extract from a video the license plates of cars , and then get a file of alphanumeric text . Thank you, you can contact me also on francescoviolo8@yahoo.it

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by