|
|
|
@ -718,9 +718,20 @@ void NdkCamera::on_image(const unsigned char* nv21, int nv21_width, int nv21_hei
|
|
|
|
|
int w = 0;
|
|
|
|
|
int h = 0;
|
|
|
|
|
int rotate_type = 0;
|
|
|
|
|
const unsigned char* yuv420data = nv21;
|
|
|
|
|
// TODO !!!???
|
|
|
|
|
// int co = camera_orientation > 0 ? camera_orientation + 90 : camera_orientation;
|
|
|
|
|
int co = (camera_orientation + m_params.orientation * 90) % 360;
|
|
|
|
|
if (m_params.orientation != 0)
|
|
|
|
|
{
|
|
|
|
|
int co = 0;
|
|
|
|
|
if (camera_facing == ACAMERA_LENS_FACING_FRONT)
|
|
|
|
|
{
|
|
|
|
|
co = (camera_orientation - (m_params.orientation - 1) * 90 + 360) % 360;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
co = (camera_orientation + (m_params.orientation - 1) * 90) % 360;
|
|
|
|
|
}
|
|
|
|
|
// int co = 0;
|
|
|
|
|
if (co == 0)
|
|
|
|
|
{
|
|
|
|
@ -747,36 +758,22 @@ void NdkCamera::on_image(const unsigned char* nv21, int nv21_width, int nv21_hei
|
|
|
|
|
rotate_type = camera_facing == 0 ? 7 : 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
cv::Mat nv21_rotated(h + h / 2, w, CV_8UC1);
|
|
|
|
|
ncnn::kanna_rotate_yuv420sp(nv21, nv21_width, nv21_height, nv21_rotated.data, w, h, rotate_type);
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
if (nv21_rotated.empty())
|
|
|
|
|
{
|
|
|
|
|
int aa = 0;
|
|
|
|
|
yuv420data = nv21_rotated.data;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// nv21_rotated to rgb
|
|
|
|
|
cv::Mat rgb(h, w, CV_8UC3);
|
|
|
|
|
// ncnn::yuv420sp2rgb(nv21_rotated.data, w, h, rgb.data);
|
|
|
|
|
ncnn::yuv420sp2rgb_nv12(nv21_rotated.data, w, h, rgb.data);
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
w = nv21_width;
|
|
|
|
|
h = nv21_height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// nv21_rotated to rgb
|
|
|
|
|
cv::Mat rgb(h, w, CV_8UC3);
|
|
|
|
|
// ncnn::yuv420sp2rgb(nv21_rotated.data, w, h, rgb.data);
|
|
|
|
|
ncnn::yuv420sp2rgb_nv12(nv21, w, h, rgb.data);
|
|
|
|
|
#endif // 0
|
|
|
|
|
// cv::Mat rgb(h, w, CV_8UC3);
|
|
|
|
|
// ncnn::yuv420sp2rgb_nv12(nv21, w, h, rgb.data);
|
|
|
|
|
ncnn::yuv420sp2rgb_nv12(yuv420data, w, h, rgb.data);
|
|
|
|
|
|
|
|
|
|
on_image(rgb);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureRequest* request, const ACameraMetadata* result)
|
|
|
|
|