Thread Subject: negative value pixel

Subject: negative value pixel

From: Ongun Palaoglu

Date: 9 Feb, 2010 23:47:05

Message: 1 of 6

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.

Subject: negative value pixel

From: Walter Roberson

Date: 10 Feb, 2010 00:06:31

Message: 2 of 6

Ongun Palaoglu wrote:
> 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.


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.

Subject: negative value pixel

From: Ongun Palaoglu

Date: 10 Feb, 2010 02:41:05

Message: 3 of 6

Walter Roberson <roberson@hushmail.com> wrote in message <hkstpn$lum$1@canopus.cc.umanitoba.ca>...
> Ongun Palaoglu wrote:
> > 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.
>
>
> 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.

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 ?

Subject: negative value pixel

From: ImageAnalyst

Date: 10 Feb, 2010 04:00:27

Message: 4 of 6

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).

Subject: negative value pixel

From: Ongun Palaoglu

Date: 10 Feb, 2010 04:32:04

Message: 5 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <59390718-862b-4b25-8059-fb025cb2b16b@k19g2000yqc.googlegroups.com>...
> 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).

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.

Subject: negative value pixel

From: Ongun Palaoglu

Date: 10 Feb, 2010 04:37:02

Message: 6 of 6

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.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com