ImgradientXY throwing errors when trying sameple code

2 ビュー (過去 30 日間)
Jiehao Zhu
Jiehao Zhu 2018 年 2 月 23 日
コメント済み: Image Analyst 2018 年 2 月 24 日
I'm playing around with the imgradientxy function
img2 = imread('image2.jpg');
[Gx,Gy] = imgradientxy(img2,'soble');
its exactly the same as the one in the documentations but it keeps throwing me the errors
Error using imgradientxy Expected input number 1, I, to be two-dimensional.

採用された回答

Jan
Jan 2018 年 2 月 24 日
Maybe the code is the same, but the inputs are not. I assume your image2.jpg is an RGB image, while imgradientxy expects a gray scale or binary image. The latter have 2 dimensions, while imread creates a 3D array of the size [M x N x 3] for color images.
  1 件のコメント
Image Analyst
Image Analyst 2018 年 2 月 24 日
Also, 'Sobel' was misspelled as 'soble'.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by