开发者

Image component multiplication without using loops in MATLAB?

开发者 https://www.devze.com 2023-02-22 13:56 出处:网络
I have开发者_如何学Python two RGB images, let\'s say A and B. Both have equal sizes with the dimension \'(x,y,3)\'. How do I multiply both images such that we take the dot product at every location an

I have开发者_如何学Python two RGB images, let's say A and B. Both have equal sizes with the dimension '(x,y,3)'. How do I multiply both images such that we take the dot product at every location and the result will be a matrix of size '(x,y) '?

For example, 'A(1,1,:)*transpose(B(1,1,:))'. With loops it is very slow.


You can use MATLAB's inbuilt function dot. So to take the dot product along the third dimension, use

C=dot(A,B,3);
0

精彩评论

暂无评论...
验证码 换一张
取 消