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><pre>for( int y = 0; y < h; y++ ) { | + | <nowiki><pre>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 10: | Line 10: | ||
where h = screen height, w = screen width and sources[1] = input | where h = screen height, w = screen width and sources[1] = input | ||
| + | |||
| + | === Mirror image === | ||
| + | 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]; | ||
Revision as of 10:19, 27 October 2019
Basic Image Processing
Displaying an Image
<pre>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];
}
}</pre>
where h = screen height, w = screen width and sources[1] = input
Mirror image
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];