opencv - How Can I Detect Any Object from Video Camera in IOS? -
i developing application identify object real world object. possible identify object video camera? on words using opencv library identify object. recording video not anything. poor ar. please suggest me have identifying real world object if possible.
step 1: follow this setup opencv camera
step 2: add code processimage delegate
- (void)processimage:(cv::mat&)image { //process here cv::cvtcolor(image, img, cv::color_bgra2rgb); int fixedwidth = 270; cv::resize(img, img, cv::size(fixedwidth,(int)((fixedwidth*1.0f)* (image.rows/(image.cols*1.0f)))),cv::inter_nearest); //update model bg_model->apply(img, fgmask, update_bg_model ? -1 : 0); gaussianblur(fgmask, fgmask, cv::size(7, 7), 2.5, 2.5); threshold(fgmask, fgmask, 10, 255, cv::thresh_binary); image = cv::scalar::all(0); img.copyto(image, fgmask); }
you'll need declare following global variable
cv::mat img, fgmask; cv::ptr<cv::backgroundsubtractor> bg_model; bool update_bg_model;
where, img <- smaller image fgmask <- mask denotes motion happening update_bg_model <- if want fixed background;
for more detail go through link
Comments
Post a Comment