Contents

OpenCV 2 Hotshot: RAW

Contents

I’m glad to publish a official announce of the OpenCV Hotshot book. This book is currently available as a RAW (Read As we Write) book. A RAW book is an ebook, and this one is priced at 20% of the usual eBook price. Once you purchase the RAW book, you can immediately download the content of the book so far, and when new chapters become available, you will be notified, and  can download the new version of the book. When the book is published, you will receive the full, finished eBook. If you like, you can preorder the print book at the same time as you purchase the RAW book at a significant discount. Visit the OpenCV Hotshots Book  page on PacktPub website. Update from August 23rd: A Packt Publishing allowed me to publish source code of the example project on the Github. Please find the most recent version of this application here: https://github.com/BloodAxe/OpenCV-Hotshots-Marker-Based-AR

Comments

kevin: hi.Ievgen, where can i download the code of the fisrst chater about the skin detection?,can u tell me

kevin: hi ,now , i want to buy this book ,how can i get the Promo Code?

kevin: hi,ievgen,just as fllows than’t ok-(void)frameReady:(BGRAVideoFrame) frame { // Start upload new frame to video memory in main thread dispatch_async( dispatch_get_main_queue(), ^{ [self.visualizationController updateBackground:frame]; }); cv::Mat bgraMat(frame.height, frame.width, CV_8UC4, frame.data, frame.stride); cv::cvtColor(bgraMat, m_grayscaleImage, CV_BGRA2GRAY); // When it’s done we query rendering from main thread dispatch_async( dispatch_get_main_queue(), ^{ [self.visualizationController drawFrame]; }); } but if i delete the two : cv::Mat bgraMat(frame.height, frame.width, CV_8UC4, frame.data, frame.stride); cv::cvtColor(bgraMat, m_grayscaleImage, CV_BGRA2GRAY); it’s will be crush, ireally don’t know why

Josh: Thanks for your response Ievgen, Re. Projection matrix - this will affect the augmentation and orientation correct? ie if incorrect will skew the view and offset the augmentation (?) I think previously when using OpenCV for AR I ended up using a library that implemented robust planar pose (RPP by Thomas Pintaric) - but the reason was because OpenCV kept crashing when trying to calculate pose (this is also fussy but didn’t jump so dramatically). Any hints on how you are improving the robustness of the marker detection i.e. are you re-using the previous pose? Thanks again for your reply - hopefully the publisher will let you release the code (out of interest - what sort of frame rate are you getting? - assuming its not optimised for clarity). Cheers, Josh

Ievgen Khvedchenia: Hello Kevin. Right now, we dont’ have promo codes for these book. As soon as publisher give us few coupons you’ll get yours!

Josh: First of, nice work - chapters are well written. If you don’t mind, I just have a couple of questions: 1. In the marker chapter you have the inverting in 2 places, once when you detect the marker and another when you are about to render it (one is assigned to the marker object and the other is a collection of Transformation objects). // Since solvePnP finds camera location, w.r.t to marker pose, to get marker pose w.r.t to the camera we invert it. m.transformation = m.transformation.getInverted(); // and again in OpenGL Matrix44 glMatrix = transformation.getInverted().getMat44(); Am I missing something? Also assume that this invert is not a Matrix invert but rather transpose of from homography to a model view matrix in openGl? … the other 2 a more general question so, obviously, feel free to ignore them. 2. I’m assuming you’re using an iPad in landscape - I’m trying to do a simple thing with a circle in portrait mode, would I need to flip your projection matrix for it to work in portrait? 3. (last one) have you come across examples when pose is very unstable (and keeps rotating the pose back and forward) - do you know if this has anything to do with the lose of precision (double to float)? Thanks and keep up the great work! Josh

Ievgen Khvedchenia: Hello Josh, Thanks for you comments. You are probably the first who got the access to the book via RAW program. Currently i’m improving my chapters according to reviewer’s comments and also rewriting sample project. What concerns your question about transformation - it’s seems that publisher uploaded old package source code. I have more recent version in my code repository on Github. I’ll ask a publisher is it allowed to make it public. Projection matrix has no common with device orientation since it depends only on camera internal parameters (intrinsic matrix). I can admit you experience issues with AR in portrait mode. It’s also caused by old code sample. Marker detection stability. Yes, current detector implementation is very “strict”. The algorithm prefers to say there is no marker if it’s not sure for 100% about it. Currently i working on improving robustness of the marker detection. If publisher allows to open access to the repository you will get access to it as soon as possible. Thanks again for your comments and loyalty.

kevin: hi,Ievgen,i have some question want to ask u , i am new to opengl,you give me a good guide,now ,i want to use your template for myseif,so first i want delete the makerdetecter, self.markerDetector->processFrame(frame);and sth relevance with it , but run it it’s dead, i don’t know why , and the i debug ,i find the first frame is good , but the the second frame comes, but frame.data is NULL,in the updateBackground , i don’t know why ,can u help me