0

what's wrong with the code below?

>> x = imread('D:\Database\vehicle\35\1.jpg');

>> x1 = rgb2gray(x);

>> x2 = edge(x1);

>> imshow(x2);

it gives this error:

Error using ==> iptcheckinput Function IMAGEDISPLAYVALIDATEPARAMS expected its first input, I, to be one of these types:

double, single, uint8, uint16, uint32, int8, int16, int32, logical

Instead its type was edge.

It does show the original and the gray image, but doesn't show the edge image. How can I show an image after edge detection?

Actually my edge function also doesn't work. When I type:

>> x2
Edge ""

The output is empty.

Hadi GhahremanNezhad
  • 2,377
  • 5
  • 29
  • 58
  • Cannot reproduce your error. The result of edge is a logical matrix which can be passed to `imshow`. Are you sure this is exactly your code and only your code? –  Jul 21 '16 at 13:24
  • Yes, it's exactly the code. I've tried every possible way and seen many examples, but it still gives that error. Isn't the output of edge function an image? – Hadi GhahremanNezhad Jul 21 '16 at 13:39
  • 1
    It seems that you have a function on your path named `edge.m` that is overloading the built-in. Check this with `which('edge')`. Then you'll want to delete it and remember to not name functions the same as built-ins. – Suever Jul 21 '16 at 13:48
  • 1
    Put a breakpoint, enter into `edge(x1);`, and follow the returned class. – Rotem Jul 21 '16 at 13:54
  • When I type `which('edge')` it shows the path: `C:\Program Files\MATLAB\R2011a\toolbox\scheduling\@edge\edge.m` . Is it the right file? – Hadi GhahremanNezhad Jul 21 '16 at 14:08
  • It got fixed. The edge function was for a different toolbox. Thank you _Suever, _Rotem and _Sembei Norimaki. – Hadi GhahremanNezhad Jul 21 '16 at 14:13
  • Closing due to minor error. – rayryeng Jul 21 '16 at 14:45

0 Answers0