没有合适的资源?快使用搜索试试~ 我知道了~
opencv旋转代码
5星 · 超过95%的资源 需积分: 10 34 下载量 31 浏览量
2010-09-23
19:52:04
上传
评论 1
收藏 3KB TXT 举报
温馨提示
试读
3页
opencv旋转代码opencv旋转代码opencv旋转代码opencv旋转代码opencv旋转代码opencv旋转代码opencv旋转代码
资源推荐
资源详情
资源评论
// PixelReadError.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
int main(int argc, char* argv[])
{
IplImage * img;
IplImage * img_Reverse;//旋转180度
IplImage * img_Rotate_90;//逆时针旋转90度
IplImage * img_Rotate_270;//逆时针旋转270度
img = cvLoadImage("1.jpg");
img_Reverse = cvCreateImage(cvGetSize(img),img->depth,img->nChannels);
img_Rotate_90 = cvCreateImage(cvSize(img->height,img->width),img->depth,img->nChannels);
img_Rotate_270 = cvCreateImage(cvSize(img->height,img->width),img->depth,img->nChannels);
int i,j;
for (i = 0; i < img->height; i++)
for (j = 0; j < img->width; j++)
{
((uchar *)(img_Reverse->imageData + (img->height - i - 1)*img_Reverse->widthStep))[j*img_Reverse->nChannels + 0] =
((uchar *)(img->imageData + i*img->widthStep))[j*img->nChannels + 0];
((uchar *)(img_Reverse->imageData + (img->height - i - 1)*img_Reverse->widthStep))[j*img_Reverse->nChannels + 1] =
((uchar *)(img->imageData + i*img->widthStep))[j*img->nChannels + 1];
((uchar *)(img_Reverse->imageData + (img->height - i - 1)*img_Reverse->widthStep))[j*img_Reverse->nChannels + 2] =
((uchar *)(img->imageData + i*img->widthStep))[j*img->nChannels + 2];
//
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
int main(int argc, char* argv[])
{
IplImage * img;
IplImage * img_Reverse;//旋转180度
IplImage * img_Rotate_90;//逆时针旋转90度
IplImage * img_Rotate_270;//逆时针旋转270度
img = cvLoadImage("1.jpg");
img_Reverse = cvCreateImage(cvGetSize(img),img->depth,img->nChannels);
img_Rotate_90 = cvCreateImage(cvSize(img->height,img->width),img->depth,img->nChannels);
img_Rotate_270 = cvCreateImage(cvSize(img->height,img->width),img->depth,img->nChannels);
int i,j;
for (i = 0; i < img->height; i++)
for (j = 0; j < img->width; j++)
{
((uchar *)(img_Reverse->imageData + (img->height - i - 1)*img_Reverse->widthStep))[j*img_Reverse->nChannels + 0] =
((uchar *)(img->imageData + i*img->widthStep))[j*img->nChannels + 0];
((uchar *)(img_Reverse->imageData + (img->height - i - 1)*img_Reverse->widthStep))[j*img_Reverse->nChannels + 1] =
((uchar *)(img->imageData + i*img->widthStep))[j*img->nChannels + 1];
((uchar *)(img_Reverse->imageData + (img->height - i - 1)*img_Reverse->widthStep))[j*img_Reverse->nChannels + 2] =
((uchar *)(img->imageData + i*img->widthStep))[j*img->nChannels + 2];
资源评论
- silvermango2012-11-14有用的代码,可以参考
- lanyanai2012-11-18不错的代码,可以参考下~
- hgclbfxxh2012-04-24代码简单可用,可以参考
- guangzhoulbbin2014-07-19谢谢 对于初学者来说非常不错
myhouseok
- 粉丝: 5
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功