# automatic traverse question

 Classic List Threaded
9 messages
Reply | Threaded
Open this post in threaded view
|

## automatic traverse question

 Hello! im = imread("xxx.jpg"); imdbl = im2double(im); resu=zeros(imdbl (:,:,1)); This without problems:resu(:,:)=imdbl(:,:,1)+imdbl(:,:,2)+imdbl(:,:,3); But here I got the error message Inconsistent row/column dimensionsresu(:,:)=abs(imdbl(:,:,1)-imdbl(:,:,2))*max(imdbl(:,:,1),imdbl(:,:,2)); Thank you for advice Erhy
Reply | Threaded
Open this post in threaded view
|

## Re: automatic traverse question

 Hello Erhy, >resu(:,:)=abs(imdbl(:,:,1)-imdbl(:,:,2))*max(imdbl(:,:,1),imdbl(:,:,2)); This syntax of max() works element-wise and returns a matrix. Then, if the matrix is not square, the * multiplication can't work here. So, depending of what you want to do, you shall either use .* instead of *, or fix the way you use max(). HTH Samuel _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

## Re: automatic traverse question

 Thank you Samuel! This works: resu(:,:)=abs(imdbl(:,:,1)-imdbl(:,:,2)) .* max(imdbl(:,:,1),imdbl(:,:,2));
Reply | Threaded
Open this post in threaded view
|

## Re: automatic traverse question

 This post was updated on . In reply to this post by Samuel GOUGEON another question gray=rand(200,300); lumimins=[ 0.1, 0.5, 0.7, 0.9 ]; // doesn't work:monos(:,:,1..length(lumimins)) = ( gray(:,:) >= lumimins(1:\$) ) .* 1; is there a way to generate planes for each lumimins with automatic traverse?
Reply | Threaded
Open this post in threaded view
|

## Re: automatic traverse question

 >another question > >gray=rand(200,300); >lumimins=[ 0.1, 0.5, 0.7, 0.9 ]; >// doesn't work*:* >monos(:,:,1..length(lumimins)) = ( gray(:,:) >= lumimins(1:\$) ) .* 1; > >is there a way to generate a plane for each lumimins with automatic traverse? gray = rand(200,300); lumimins = [ 0.1, 0.5, 0.7, 0.9 ]; Gray = gray .*. ones(1,1,length(lumimins)); L = ones(gray) .*. permute(lumimins,[1 3 2]); monos = (Gray >= L) * 1; _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

## Re: automatic traverse question

 much learned - thank you Erhy
Reply | Threaded
Open this post in threaded view
|

## Re: automatic traverse question

 In reply to this post by Samuel GOUGEON I studied your solution and think there will be a very huge array with kronecker operator and  generated the planes with a for loop. And now I have the problem with the max() function for all planes, at which in the resulting plane each pixel should have the max. values  of the according pixels of the planes mentioned. max() works of a known number of planes: resu=max(monos (:,:,1),monos (:,:,2),monos (:,:,3)) What is the smartest way to code, if the number of planes can differ?
Reply | Threaded
Open this post in threaded view
|

## Re: automatic traverse question

 Hello Erhy, >I studied your solution and think there will be a very huge array with >kronecker operator and  generated the planes with a for loop. There is a common compromise between the used amount of memory and the algorithmic speed. There we are. >And now I have the problem with the max() function for all planes, >at which in the resulting plane each pixel should have the max. values  of >the according pixels of the planes mentioned. > >max() works of a known number of planes: >resu=max(monos (:,:,1),monos (:,:,2),monos (:,:,3)) > >What is the smartest way to code, if the number of planes can differ? I am afraid that i don't clearly catch your point. If what i guess is not too far from what you mean, here is a way: MAX = monos(:,:,1); for i = 2:N    MAX = max(MAX, monos(:,:,i)) end Samuel _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

## Re: automatic traverse question

 as I did thank you