From: mira on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hpij0l$bvb$1(a)fred.mathworks.com>...
> "mira " <files(a)mathworks.com> wrote in message <hpiaa3$q5l$1(a)fred.mathworks.com>...
> > hey everybody,
> >
> > I have a problem finding the first and second derivative of an image, I think the the diff() method does that, but I don't want to apply it to the image what I want is to find the value ( numerical one ) of the 1'st & 2'nd derivative for the image.
> ==============
>
> This is contradictory. You claim that the diff() function both does and doesn't do what you want in the same sentence.

Matt J I did say that it gives the first and second derivative and it works fine , but I don't want the result as image I want it to be a numerical value that is the problem
From: Matt J on
"mira " <files(a)mathworks.com> wrote in message <hpipbu$lq5$1(a)fred.mathworks.com>...

> > > I have a problem finding the first and second derivative of an image, I think the the diff() method does that, but I don't want to apply it to the image what I want is to find the value ( numerical one ) of the 1'st & 2'nd derivative for the image.
> > ==============
> >
> > This is contradictory. You claim that the diff() function both does and doesn't do what you want in the same sentence.
>
> Matt J I did say that it gives the first and second derivative and it works fine , but I don't want the result as image I want it to be a numerical value that is the problem
=================

Then you need to explain your semantics better, in particular, why you think the derivative can produce only a single value when in general the derivative of any function is another function, and not a scalar.

The output of differentiation operation is a scalar in specific circumstances, like if you are taking a derivative at one specifc point, but you need to say if that's the situation that applies here.
From: Roger Stafford on
"mira " <files(a)mathworks.com> wrote in message <hpipbu$lq5$1(a)fred.mathworks.com>...
> "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hpij0l$bvb$1(a)fred.mathworks.com>...
> > "mira " <files(a)mathworks.com> wrote in message <hpiaa3$q5l$1(a)fred.mathworks.com>...
> > > hey everybody,
> > >
> > > I have a problem finding the first and second derivative of an image, I think the the diff() method does that, but I don't want to apply it to the image what I want is to find the value ( numerical one ) of the 1'st & 2'nd derivative for the image.
> > ==============
> >
> > This is contradictory. You claim that the diff() function both does and doesn't do what you want in the same sentence.
>
> Matt J I did say that it gives the first and second derivative and it works fine , but I don't want the result as image I want it to be a numerical value that is the problem

Mira, when you said "frequency" in "... first derivative to get frequency of gray scale changes ..." that was the first clue I had that you could be talking about derivatives with respect to time, not space. If that is what you mean, then yes, there would only be one second derivative with respect to time for each pixel of an image changing in time. Is that what you meant?

As to the "numerical" you speak of, the 'diff' function in matlab can find symbolic derivatives or differences in numerical arrays depending on what kind of argument it is given. (It is unfortunate in my opinion that Mathworks used the same name for both functions.) The numerical differences with 'diff' are probably not a good way of computing numerical derivatives. You should use the 'gradient' function instead because it allows you to set in the values of interval steps in the independent variable to ensure reliable derivatives.

You still appear to be contradicting yourself when you say that "it works fine" but you want it "to be a numerical value". The only way I see out of this contradiction is that you were speaking of a symbolic derivative of the kind that 'diff' can produce on symbolic expressions. However, I find it difficult to imagine that you actually possess symbolic expressions for each image pixel value as functions of time. If you don't have such symbolic expressions, what can you possibly mean by "it works fine"? What works fine? Can you straighten out that apparent contradiction for us, please?

A lot of time is being wasted in this thread through unclear statements.

Roger Stafford
From: Walter Roberson on
Roger Stafford wrote:

> You still appear to be contradicting yourself when you say that "it
> works fine" but you want it "to be a numerical value". The only way I
> see out of this contradiction is that you were speaking of a symbolic
> derivative of the kind that 'diff' can produce on symbolic expressions.


Either that or mira had not yet understood that as far as Matlab is concerned,
"image" and "array" are the same thing --- that once an image has been read in
from a file, it becomes a Matlab array and can be operated on mathematically;
and that, likewise, any Matlab array within certain constraints can be
displayed as an image.
From: ImageAnalyst on
On Apr 7, 2:52 pm, ImageAnalyst <imageanal...(a)mailinator.com> wrote:
> You can do it with the conv2() function - just pass in the correct
> kernel, for example
> -1 -1 -1
> -1  8 -1
> -1 -1 -1

------------------------------------------------------------------------------
mira:
If you want to see how you can do it with convolution or imfilter,
just check out
http://www.ph.tn.tudelft.nl/Courses/FIP/noframes/fip-Derivati.html
for examples.