Ask Your Question

Dany's profile - activity

2016-05-27 04:41:19 -0600 commented question Conversion NV21 (YUV420s) to RGB

I work on an old project, I can't change the structure: it's too much work. This code doesn't crash:

Mat yuv(height + height / 2, width, CV_8UC1, sampleBuffer);
Mat rgb(height, width, CV_8UC3);
cvtColor(yuv, rgb, COLOR_YUV2RGB_NV21);

However, I really need an IplImage in output.

2016-05-27 04:18:00 -0600 received badge  Editor (source)
2016-05-27 03:49:24 -0600 asked a question Conversion NV21 (YUV420s) to RGB

I want to convert NV21 image to RGB image using IplImage (old c++ code source).

IplImage *p_imageYUV420s = cvCreateImage(cvSize(height + height / 2, width), IPL_DEPTH_8U, 1);
memcpy(p_imageYUV420s->imageData, sampleBuffer, 115200);
IplImage *p_imageRGB = cvCreateImage(cvSize(height, width), IPL_DEPTH_8U, 3);
cvCvtColor(p_imageYUV420s, p_imageRGB, COLOR_YUV2RGB_NV21);

When I execute this code, I get the following error :

cv::error(): OpenCV Error: Assertion failed (sz.width % 2 == 0 && sz.height % 3 == 0 && depth == CV_8U) in void cv::cvtColor(cv::InputArray, cv::OutputArray, int, int), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/color.cpp, line 4227

Do you know how to solve this problem? And is there a way to convert back the image to NV21 format? Thanks.

2016-05-23 04:04:16 -0600 answered a question Android undefined reference to 'cvUpdateMotionHistory'

I changed opencv version (3.1.0 to 2.4.9) and it works. Notice that I use this command to build:

ndk-build APP_ABI=all APP_STL=gnustl_static APP_CPPFLAGS=-frtti APP_CPPFLAGS+=-fexceptions APP_PLATFORM=android-17
2016-05-23 02:55:36 -0600 received badge  Scholar (source)
2016-05-20 09:56:10 -0600 asked a question Android undefined reference to 'cvUpdateMotionHistory'

I am trying to use opencv source code from Windows in Android. So I want to use native C/C++ opencv code in android. I followed this tutorial to do it : http://docs.opencv.org/2.4/doc/tutori...

Everything work perfectly, except this line :

cvUpdateMotionHistory(p_silhouette, p_mhi, timestamp, MHI_DURATION);

I get this error when I run "ndk-build APP_ABI=all APP_STL=gnustl_static" :

error: undefined reference to 'cvUpdateMotionHistory'

Android.mk :

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_LIB_TYPE := STATIC
OPENCV_INSTALL_MODULES := on
OPENCV_CAMERA_MODULES := off
include D:/Resources/opencv_v310_android/sdk/native/jni/OpenCV.mk
LOCAL_MODULE := Motor
LOCAL_SRC_FILES := package_Motor.cpp
LOCAL_SRC_FILES += motor/motor.cpp
LOCAL_LDFLAGS := -llog
include $(BUILD_SHARED_LIBRARY)

Do you have any idea how to solve this problem? Thanks.