简体   繁体   中英

Image component multiplication without using loops in MATLAB?

I have 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM