Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

negative value pixel

0 views
Skip to first unread message

Ongun Palaoglu

unread,
Feb 9, 2010, 6:47:05 PM2/9/10
to
Hello, We are working on a project, our project is motion detection, currently we are working on image differences when subtract images I get - values but matlab does not show that. I need to find it to calculate the distance between the first location and the second location of the object. How can i represent the (-) values . I am using he function [p,thresh]=edge(f,'canny'), to find the edges. then middle point. - pixels shows up black so the subtracted image is blank.

Walter Roberson

unread,
Feb 9, 2010, 7:06:31 PM2/9/10
to


What is the data type of the pixels? If it is uint8, as would not be uncommon
for images, then you cannot represent a negative value with that data class,
so to subtract the values you would first have to convert them to int16 or
similar.

Ongun Palaoglu

unread,
Feb 9, 2010, 9:41:05 PM2/9/10
to
Walter Roberson <robe...@hushmail.com> wrote in message <hkstpn$lum$1...@canopus.cc.umanitoba.ca>...

Thank you for your reply,

Yes, I was using uint8, I changed it to
" subframe=int16(img(24).cdata)-int16(img(1).cdata); "

However How can I convert back them to image so that i can find the middle point of the object ?

ImageAnalyst

unread,
Feb 9, 2010, 11:00:27 PM2/9/10
to
Not sure what you're talking about. The subtraction IS an image. But
you're expecting us to give image processing advice without even
giving us images to look at???

Post your images somewhere (such as http://drop.io) so we can see.
Post your two frames and the subtracted one if possible (you might
have to scale it to 0-255 to save it in a standard format such as png
or tif).

Ongun Palaoglu

unread,
Feb 9, 2010, 11:32:04 PM2/9/10
to
ImageAnalyst <imagea...@mailinator.com> wrote in message <59390718-862b-4b25...@k19g2000yqc.googlegroups.com>...

Hey, thank you for your reply

I am not working on with direct images, I am loading them from .avi file. the avi file is the same like the png files " http://drop.io/sjfxl0g ". Black circle is moving . I need to detect the motion. I subtract them then find the edges, so that I can compute the middle points of the objects in one frame.

Ongun Palaoglu

unread,
Feb 9, 2010, 11:37:02 PM2/9/10
to
y=imread('1.png');
y=rgb2gray(y);
p=edge(y,'canny');

[r,c,v]=find(p>0.1);

r=mean(r);
c=mean(c);
subplot(2,2,1);imshow(p)
hold on
plot(c,r,'.')

This code works for one object.

0 new messages