当前位置:网站首页>Opencv image rotation
Opencv image rotation
2022-07-03 10:06:00 【Σίσυφος one thousand and nine hundred】
One 、 Image rotation
operator :transpose(src, src);
transpose() Pixel subscript can be realized x and y Adjust the axis coordinates :dst(i,j)=src(j,i), Interface form
transpose(
InputArray src, // The input image
OutputArray dst, // Output
)
operator :flip(src, src, 1);
flip() Function to flip the image horizontally 、 Flip vertically and flip Bi directionally
void flip(
InputArray src, // The input image
OutputArray dst, // Output
int flipCode = 0 // >0: Along the y- The axis turns , 0: Along the x- The axis turns , <0: x、y The axis turns at the same time
);
flip(img1,0)# Flip the horizontal axis ( Flip up and down )
flip(img1,1)# Flip the vertical axis ( Flip left and right )
flip(img1,-1)# Flip both ways Two 、 Code shows
#if 1 // Rotation Angle
Mat rotate_img(Mat src, int idx) {
// rotate 90 degree
if (idx == 1) {
transpose(src, src);
flip(src, src, 1);
return src;
}
// rotate 180 degree
else if (idx == 2) {
flip(src, src, 0);
flip(src, src, 1);
return src;
}
// rotate 270 degree
else if (idx == 3) {
transpose(src, src);
flip(src, src, 0);
return src;
}
else {
return src;
}
}
int main() {
Mat src = imread("C:\\Users\\19473\\Desktop\\opencv_images\\33.jpg");
if (!src.data)
{
printf("could not load image....\n");
}
imshow(" Original picture ", src);
Mat m1= rotate_img(src,1); //90 degree
imshow("90 degree ", m1);
Mat m2 = rotate_img(src, 2); //180 degree
imshow("180 degree ", m2);
Mat m3 = rotate_img(src, 3); //270 degree
imshow("270 degree ", m3);
waitKey(0);
return 0;
}
#endif



边栏推荐
- getopt_ Typical use of long function
- 4G module at command communication package interface designed by charging pile
- Swing transformer details-2
- My openwrt learning notes (V): choice of openwrt development hardware platform - mt7688
- Swing transformer details-1
- Basic knowledge of MySQL database (an introduction to systematization)
- Dictionary tree prefix tree trie
- Screen display of charging pile design -- led driver ta6932
- Education is a pass and ticket. With it, you can step into a higher-level environment
- 要選擇那種語言為單片機編寫程序呢
猜你喜欢

yocto 技术分享第四期:自定义增加软件包支持

Not many people can finally bring their interests to college graduation

Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program

My notes on the development of intelligent charging pile (III): overview of the overall design of the system software

LeetCode 面试题 17.20. 连续中值(大顶堆+小顶堆)

Retinaface: single stage dense face localization in the wild
![[combinatorics] Introduction to Combinatorics (combinatorial idea 3: upper and lower bound approximation | upper and lower bound approximation example Remsey number)](/img/19/5dc152b3fadeb56de50768561ad659.jpg)
[combinatorics] Introduction to Combinatorics (combinatorial idea 3: upper and lower bound approximation | upper and lower bound approximation example Remsey number)

Crash工具基本使用及实战分享

Pycharm cannot import custom package

LeetCode - 706 设计哈希映射(设计) *
随机推荐
There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way
Uniapp realizes global sharing of wechat applet and custom sharing button style
Pymssql controls SQL for Chinese queries
Gpiof6, 7, 8 configuration
STM32 interrupt switch
4G module designed by charging pile obtains signal strength and quality
Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
el-table X轴方向(横向)滚动条默认滑到右边
Octave instructions
Emballage automatique et déballage compris? Quel est le principe?
Simulate mouse click
Windows下MySQL的安装和删除
Tensorflow built-in evaluation
Problems encountered when MySQL saves CSV files
Simple use of MySQL (addition, deletion, modification and query)
Window maximum and minimum settings
My 4G smart charging pile gateway design and development related articles
学习开发没有捷径,也几乎不存在带路会学的快一些的情况
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
2021-01-03