So, I have this activity when I have to take an image, divide it into four quadrants and then rotate the quadrants 1 nd four in the same imagen, without creating another window. I have already this code but I just got to make the rotations in differents windows and that's my main issue. If this helps, I made the code in Visual Studio, with a CLR Project. Thank you.
#include "stdafx.h"
#include <iostream>
#include <opencv\cv.h>
#include <opencv\cxcore.h>
#include <opencv\highgui.h>
#include <cmath>
using namespace System;
using namespace std;
using namespace cv;
int main( int argc, char** argv ){
CvPoint pt1, pt2;
int width;
int height;
IplImage* img = cvLoadImage("C:/Users/Munii/Documents/Visual Studio 2010/Projects/Proyecto/Proyecto/Imagen.jpg");
pt1.x=0;
pt1.y=0;
pt2.x = (img->width)/2;
pt2.y = (img->height)/2;
width = img->width;
height = img->height;
IplImage* rotated=cvCreateImage(cvGetSize(img),IPL_DEPTH_8U,img->nChannels);
CvPoint2D32f center;
float angle=180;
CvMat* M = cvCreateMat(2,3,CV_32FC1);
center.x = (img->width)/2.0;
center.y = (img->height)/2.0;
cv2DRotationMatrix(center,angle,1.0,M);
cvWarpAffine(img,rotated,M,CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, cvScalarAll(0));
cvSetImageROI(rotated, cvRect( pt1.x, pt1.y, pt2.x, pt2.y));
pt1.x = (img->width)/2;
pt1.y = (img->height)/2;
pt2.x = img->width;
pt2.y = img->height;
IplImage* rot=cvCreateImage(cvGetSize(img),IPL_DEPTH_8U,img->nChannels);
center.x=img->width/2.0;
center.y=img->height/2.0;
cv2DRotationMatrix(center,angle,1.0,M);
cvWarpAffine(img,rot,M,CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, cvScalarAll(0));
cvSetImageROI(rot, cvRect( pt1.x, pt1.y, pt1.x, pt2.y));
cvNamedWindow("Ejemplo 3", CV_WINDOW_AUTOSIZE); //creamos una ventana con el nombre Ejemplo 3
cvNamedWindow("ROI", CV_WINDOW_AUTOSIZE);
cvNamedWindow("RO", CV_WINDOW_AUTOSIZE); //creamos una ventana con el nombre ROI donde estará la región de interes
cvShowImage("Ejemplo 3", img);
cvShowImage("ROI",rotated);
cvShowImage("RO",rot); //mostramos la imagen en la ventana anteriormente creada
cvSaveImage("C:/Users/Munii/Documents/Visual Studio 2010/Projects/Proyecto/Proyecto/RotacionI.jpg", rotated);
cvSaveImage("C:/Users/Munii/Documents/Visual Studio 2010/Projects/Proyecto/Proyecto/RotacionIV.jpg", rot);
cvWaitKey(0);
cvDestroyWindow("ROI" );
cvDestroyWindow("RO" );
cvReleaseImage( &img );
cvDestroyWindow("Ejemplo3" );
cvReleaseImage(&rotated);
cvReleaseMat(&M);
}