I am going to set my image like that.. it looks like image A to B but i cant ... i want to change Image A with some and it becomes Image B...Its done in photoshop but in cocos2d..How can i do..Check images below...
Image A:
The Image B is:
How can i do this with sprite.rotation = -30?
or some other way?
Related
So far Ive succesfully calibrated a camera with Opencv by using the chessboard pattern in the tutorials, so I got the cameraMatrix, distCoefs, Rotation and Translation vectors.
Now Id like to display an image on top of my chessboard using the calibration parameters. How can I do that?
These are the steps Ive done so far:
1 - Get the chessboard corners
2 - projectPoints to get from world (640x480) to the warped frame seen during the calibration
3 - getPerspectiveTransform to get the transformation from world to warped image
4 - warpPerspective to get the image coordinates (the image Id like to display on top of the chessboard) to warp
5 - Create a mask on top of the chessboard
6 - flip the image Id like to display
7 - And finally copy the warped image to video frame on top of the area delimited by the mask.
Corners and mask are working fine. But Im not quite sure about the rest of the process.
Can anyone help me?
see this post i think my code will help you, i have an error but to understand how to make it i think the code will be good:
https://stackoverflow.com/questions/34785237/augmented-reality-projection-cube-error
good luck
PD : The code is in python !
I Have an image as background, and an image from the background with the shape in it. I want to recognize the shape as fast as possible. One of the things I tried was:
Mat img, img_background;
.
.
.
img = img - img_background;
But in some images, it didn't work. There was another way to compare all of the pixels in both images and it worked, But it was pretty slow. I want to know is there a way to recognize the shape as fast as possible? Thanks for your help.
And I have a question. Why the code I wrote(img = img - img_background) didn't work?
I could fix it with the code below:
cv::absdiff(img, img_bk, img);
Mat m = Mat::zeros(img.size(), img.type());
m.setTo(Scalar::all(255));
img = m - img;
I guess this code works. Thank you for your helps.
I have two images
one: is cropped image with dimension
another: is black image with different dimension
now i need to put the first image in center of the second image
any one can help me
thanks
Assuming black image is larger then cropped image and both images are same type and same channels:
cropped_image.copyTo(my_black_image(cv::Rect((my_black_image.cols - cropped_image.cols)/2, (my_black_image.rows - cropped_image.rows)/2, cropped_image.cols, cropped_image.rows)));
I have a sample image as below. I would like to make the square my Region of Interest and then crop out that part (square) and create a new image with it. I will be working with different images so the square won't always be at the same location in all images. So I will need to somehow detect the edges of the square.
I can not post pictures because I have 10 reputations
help me please??
Thank you very much
cvSetImageROI(currentImage,yourSquare);
CvSize size = cvSize(width, height);
IplImage * newImage = cvCreateImage(size,8,3);
cvResize(currentImage,newImage,CV_INTER_AREA);
First you must set your ROI with cvSetImageROI(IplImage*,CvRect). After that you create your new image with the desired width and height. Finally you can copy your old image to the new one. The new image will contain your desired ROI.
I am currently implementing some application using cocos2d that requires capturing image from camera and applying some effects. In order to apply these effects images should be added to CCNode. So my question is: how can I capture image from camera and save it to CCSprite or somehow add it to CCLayer?
I would much appreciate your help!
yes you can do that and it is quite easy!
Once you use the camera to get an image you will have an UIImage object. Then all you have to do is this:
CGImageRef imageref = [image CGImage]; //image is the UIImage retrieved from the camera or photo library.
CCSprite * mySprite =[CCSprite spriteWithCGImage:imageref key:nil];
You can then treat mySprite as any regular sprite.