i have a small problem in dithring code when i run the code i get this massage error:
??? Error using ==> gt Matrix dimensions must agree.
i chang the matrix size in repmat(d,128,128) but even of that i get the same message error also i search for alooong time but i could not find the solution for this problem
this is my code: f=imread('2.png'); f2=rgb2gray(f); imshow(f2) d=[0,128;192,64]; r=repmat(d,128,128) f3=f2>r;imshow(f3)
plz i need a small help

 Réponse acceptée

Paulo Silva
Paulo Silva le 7 Avr 2011

0 votes

f2 and r don't have the same dimensions for sure, that gt in the error stands for greater than. try this:
isequal(size(f2),size(r))
if the answer is 0 they aren't of equal dimensions

7 commentaires

ram
ram le 7 Avr 2011
yes the answer is zero :(
how can i make matrix 2x2 has the same dimension as my image??
Paulo Silva
Paulo Silva le 7 Avr 2011
what's the image size?
ram
ram le 7 Avr 2011
thx alot for answering my quastion
from where can i know the size of image??
>>... i am begginer in matlab
did u mean this?
cdata 512x512
colormap 265x3
Paulo Silva
Paulo Silva le 7 Avr 2011
by size I was referring to the number of pixels, usually it's one array like the cdata one, this should work:
r=repmat(d,256,256) %notice that 256 is 512/2 because d is two lines by two columns
ram
ram le 7 Avr 2011
Déplacé(e) : DGM le 29 Déc 2023
thax aloooot it works :)))
r=repmat(d,256,256) %notice that 256 is 512/2 because d is two lines by two columns
did u mean if i use matrix 4x4 like: D2 = [0 128 32 160; 192 64 224 96; 48 176 16 144; 240 112 208 80];
it should be like that: r2 = repmat(D2,128,128);??
Paulo Silva
Paulo Silva le 7 Avr 2011
Déplacé(e) : DGM le 29 Déc 2023
yes
ram
ram le 7 Avr 2011
Déplacé(e) : DGM le 29 Déc 2023
thx alot i realy appreciate your help
i spend the whole week looking 4 the solution
u realy save my time
:)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by