Image size of origin is 320*240.
Processing time is 30.96 second took.
The result of stitching
The result is pretty good. but, processing time is too much takes.
My computer spec is that.. (This is vmware system. The main system is mac book air 2013, i7 8bg)
The source code is very easy.
I think if we use stitching algorithm in realtime, we should be programing by GPU.
/////
#include < stdio.h > #include < opencv2\opencv.hpp > #include < opencv2\stitching\stitcher.hpp > #ifdef _DEBUG #pragma comment(lib, "opencv_core246d.lib") #pragma comment(lib, "opencv_imgproc246d.lib") //MAT processing #pragma comment(lib, "opencv_highgui246d.lib") #pragma comment(lib, "opencv_stitching246d.lib"); #else #pragma comment(lib, "opencv_core246.lib") #pragma comment(lib, "opencv_imgproc246.lib") #pragma comment(lib, "opencv_highgui246.lib") #pragma comment(lib, "opencv_stitching246.lib"); #endif using namespace cv; using namespace std; void main() { vector< Mat > vImg; Mat rImg; vImg.push_back( imread("./stitching_img/S1.jpg") ); vImg.push_back( imread("./stitching_img/S2.jpg") ); vImg.push_back( imread("./stitching_img/S3.jpg") ); vImg.push_back( imread("./stitching_img/S4.jpg") ); vImg.push_back( imread("./stitching_img/S5.jpg") ); vImg.push_back( imread("./stitching_img/S6.jpg") ); Stitcher stitcher = Stitcher::createDefault(); unsigned long AAtime=0, BBtime=0; //check processing time AAtime = getTickCount(); //check processing time Stitcher::Status status = stitcher.stitch(vImg, rImg); BBtime = getTickCount(); //check processing time printf("%.2lf sec \n", (BBtime - AAtime)/getTickFrequency() ); //check processing time if (Stitcher::OK == status) imshow("Stitching Result",rImg); else printf("Stitching fail."); waitKey(0); }/////
github
https://github.com/MareArts/Still-Image-Stitching-Test-Using-OpenCV
N image, realtime stitching.
source code:
http://study.marearts.com/2016/10/real-time-n-camera-stitching-class.html
how to work:
http://study.marearts.com/2015/02/real-time-stitching-multi-video-to-one.html
2 image stitching.
basic principal on vidoe(code and explanation):
http://study.marearts.com/2013/10/two-view-of-cam-to-one-screen-using.html
basic principal on image(code and explanation):
http://study.marearts.com/2011/08/two-image-mosaic-paranoma-based-on-sift.html
I have decided to sell source code ^^
If you have interest, go to here, you can buy source code.
Thank you very much!!
Saludos muy bueno el artículo. Faltaría la imagen 4.
ReplyDeletegreat blog mare! thank for your sharing
ReplyDeleteThank you very much~!! ^^
ReplyDeleteThe code work well when I stitched using only two of your images, but gave the following errors when used more than 2 image.
ReplyDeleteFirst-chance exception at 0x5baa677a in TEST_CV.exe: 0xC0000005: Access violation reading location 0x00000004.
First-chance exception at 0x756d9617 in TEST_CV.exe: Microsoft C++ exception: tbb::captured_exception at memory location 0x0012eaf4..
Unhandled exception at 0x756d9617 in TEST_CV.exe: Microsoft C++ exception: tbb::captured_exception at memory location 0x0012eaf4..
Please help me in fixing that.
Can you send me the image files? I will test on my computer. Thank you.
ReplyDeleteMy email is feelmare@gmail.com
It's great code.... but I have problem with image that captured with fisheye lens.. how to stitch that images? any suggestions?
ReplyDeleteIn my opinion, case of fisheye lens, you should do undistortion processing first.
ReplyDeleterefer to this page -> http://www.kscottz.com/fish-eye-lens-dewarping-and-panorama-stiching/
This comment has been removed by the author.
ReplyDeleteit is great code ,,,, but can you help me how can i stitching video files together ???
ReplyDeletethanks
Real-time video stitching is little bit different with image.
ReplyDeleteBig problem is proccesing time is late.
In order to implementation, Structure must be sperate of online and offline calculation part.
Please refer to the source code "stitching_detailed.cpp" of Opencv samples
I made real-time stitching program but I am difficult to share the code.
Because the source code is owned by my company.
refer to this video.
http://www.youtube.com/watch?v=Zkrn-rooj0M
http://www.youtube.com/watch?v=jP1Y8nd0mQc
Thank you.
This comment has been removed by the author.
ReplyDeleteI have used the same code and it is running fine sometimes. But if I run it continuously more than two times, it is crashing.. giving the following error.
ReplyDeleteAccess violation reading location 0x0000000000000008. and it the cursor is pointing to
pChore->m_pFunction(pChore); in Chores.cpp file.
When I ran using 640x480 size images, the application is generating panorama for 2 images and crashing some times for the same set of images. Moreover it is not able to run for more than 2 images.
Can you please let me know why it is happening like this?
This comment has been removed by the author.
Deletehi , i faced same problem .... but when i using small images (320*240) for example , it will be correctly done .
DeleteThis comment has been removed by the author.
ReplyDeleteHi, I have some problems when using the stitcher, maybe you can help me. I guess I'll remit to you personally by mail with the image. Thank you in advance.
ReplyDeleteI test your image
Deleteand upload code to github
https://github.com/MareArts/Still-Image-Stitching-Test-Using-OpenCV
Check output.jpg file
and code
Thank you.
Thank you for your quick reply. It's strange your code is similar to mine and mine is not working properly. I´m using VS2013 as well, but OpenCV 3.1.0 x64 without Gpu, while you are using OpenCV 2.4.9 with Gpu. Do you know if the reason of my artifacts has to to with any of these three differences?
DeleteI think default option is different.
DeleteDefault option looks similar (GraphCutSeamFinder(CostColor), BlocksGainCompensator and MultibandBlender after registration). Could it be due to any change in any of these blocks (probably multiband blender), that is messing up everything in the new version of OpenCV?
DeleteHi, There was a run-time error on my PC. It says, "Unhandled exception at 0x00871BDA (opencv_imgproc2412d.dll) in T3.exe: 0xC000001D: Illegal Instruction." I use VS2012 and opencv2.4.12. Could you please help me?
ReplyDeleteI don't know about this error.
DeletePlease check build option 32bit, 64bit.
lib build condition. gpu include?
function usage different in another opencv version?
you can try in release type, it will be fine!
Deletei pasted this code in geany editor. compilation error ocured/home/aftab/Pictures/Screenshot from 2016-04-29 00:03:43.png
ReplyDeleteHi Mare, thanks for the code. I used your exact code on my machine and fed the same set of input images, but my resulting image wasn't complete like yours. It looks like it did some stitching but not completely. Any ideas what may be wrong? Thanks!
ReplyDeleteYour code has 6 input images.
ReplyDeleteBut there are only 5 pictures.
I tried running the program using your code.
Pictures 5 and 6 do not appear in the execution window.
And the input image was replaced with another image. But stitching failed.
It is example of Stitcher in OpenCV library.
DeleteIt is very simple code, if you input overlap images.
If a common feature can not be found in the image, stitching may fail.
This comment has been removed by the author.
ReplyDeleteHi you know any example of stitching but with the opossite perspective.
ReplyDeleteSomething like this:
http://www.diga.me.uk/360degreeCamera.html
My intention to carry out an inspection of labels in metal cans.
Thanks in advance
Dear Mare! you're really doing nice job. Please let me know about your platform specification while executing your code for stitching images.
ReplyDeleteHope to hearing from you soon.
Thanks,
Abdul Wahab
I am using window os, and visuals studio.
Deletethis code is standard code, so opencv version, platform(32/64), cuda version.. is not specification.
Thank you.
Hello,
ReplyDeleteI am using opencv 3.2 version with visual stuio 2017 and I am getting some errors.Could you please suggest me how should we resolve these errors so that it works on my software platform.
hi i am student and i am trying to do real time video stitching as my project but i don't even know the basics of the stitching and all those stuff can you help me with my project please. please send me your email address.to my mail (itachi.s.a4@gmail.com)
ReplyDeleteHi,
ReplyDeleteI want to create a long panorama from video feed by breaking into frames adn then stitching. The final image I am getting is very blurry on one side. I think its warping too much. Can you help me? I will sen dyou the sourc code and image output. Can you take a look at it?