Difference between revisions of "KIAS primer"
From Cinemachines
Line 1: | Line 1: | ||
== Basic Image Processing == | == Basic Image Processing == | ||
=== Displaying an Image === | === Displaying an Image === | ||
− | <nowiki | + | <nowiki>for( int y = 0; y < h; y++ ) { |
for( int x = 0; x < w; x++ ) { | for( int x = 0; x < w; x++ ) { | ||
dist.at<Vec3b>(y,x)[0] = sources[1].at<Vec3b>(y,x)[0]; | dist.at<Vec3b>(y,x)[0] = sources[1].at<Vec3b>(y,x)[0]; | ||
Line 7: | Line 7: | ||
dist.at<Vec3b>(y,x)[2] = sources[1].at<Vec3b>(y,x)[2]; | dist.at<Vec3b>(y,x)[2] = sources[1].at<Vec3b>(y,x)[2]; | ||
} | } | ||
− | } | + | }</nowiki> |
where h = screen height, w = screen width and sources[1] = input | where h = screen height, w = screen width and sources[1] = input | ||
=== Mirror image === | === Mirror image === | ||
− | + | <nowiki>for( int y = 0; y < h; y++ ) { | |
− | + | for( int x = 0; x < w; x++ ) { | |
− | + | dist.at<Vec3b>(y,x)[0] = sources[1].at<Vec3b>(y,(w-x))[0]; | |
+ | dist.at<Vec3b>(y,x)[1] = sources[1].at<Vec3b>(y,(w-x))[1]; | ||
+ | dist.at<Vec3b>(y,x)[2] = sources[1].at<Vec3b>(y,(w-x))[2]; | ||
+ | } | ||
+ | }</nowiki> |
Revision as of 11:20, 27 October 2019
Basic Image Processing
Displaying an Image
for( int y = 0; y < h; y++ ) { for( int x = 0; x < w; x++ ) { dist.at<Vec3b>(y,x)[0] = sources[1].at<Vec3b>(y,x)[0]; dist.at<Vec3b>(y,x)[1] = sources[1].at<Vec3b>(y,x)[1]; dist.at<Vec3b>(y,x)[2] = sources[1].at<Vec3b>(y,x)[2]; } }
where h = screen height, w = screen width and sources[1] = input
Mirror image
for( int y = 0; y < h; y++ ) { for( int x = 0; x < w; x++ ) { dist.at<Vec3b>(y,x)[0] = sources[1].at<Vec3b>(y,(w-x))[0]; dist.at<Vec3b>(y,x)[1] = sources[1].at<Vec3b>(y,(w-x))[1]; dist.at<Vec3b>(y,x)[2] = sources[1].at<Vec3b>(y,(w-x))[2]; } }