이 OpenCV4Android 샘플 애플리케이션에서 이 코드는 무엇을 합니까? (What does this piece of code do in this OpenCV4Android sample application?)


문제 설명

이 OpenCV4Android 샘플 애플리케이션에서 이 코드는 무엇을 합니까? (What does this piece of code do in this OpenCV4Android sample application?)

색상 얼룩 감지 샘플의 ColorBlobDetectionActivity 클래스와 내가 이해하기 어려운 특정 코드 덩어리는 onTouch 메소드.

onTouch 메소드가 호출될 때, 즉 사용자가 컬러 블롭을 터치할 때, int rows= mRgba.rows()int cols = mRgba.cols()가 계산됩니다. mRgba는 <에 의해 반환된 Mat이기 때문에 code>onCameraFrame(), 그것은 카메라 프레임을 나타낸다는 것을 의미합니다. 따라서 rowscols는 이제 x축을 따라 픽셀 수를 나타내고, 프레임의 y축을 따라

프레임은 카메라가 보는 영역(이 앱에서는 기기의 전체 화면임)이므로 rowscols는 다음을 나타냅니다. 각각 화면의 x축과 y축에 따른 픽셀 수입니다.

다음 두 문장은 다음과 같습니다.

int xOffset = (mOpenCvCameraView.getWidth() ‑ cols) / 2;
int yOffset = (mOpenCvCameraView.getHeight() ‑ rows) / 2;

질문은 다음과 같습니다.

  1. xOffsetyOffset은 정확히 무엇을 나타냅니까?

  2. mOpenCvCameraView CameraBridgeViewBase의 인스턴스입니다. "nofollow">문서는 Camera와 OpenCV의 상호 작용을 구현하는 기본 클래스입니다. 문서 getWidth()getHeight()는 무음이지만 카메라 프레임의 너비와 높이(픽셀 단위)이기도 하므로 rowcol과 동일해야 합니다. 맞나요?


  3. 참조 솔루션

    방법 1:

    The delivered frames and the surface size are not necessarily the same. The maximum of the event.getX equals to the surface width.

    I haven't seen the program running, but it seems like the offset determines the size of the touched rect. The rect is used for averaging the color, not simply displaying a single pixel's data.

    (by SolaceMice Pápai)

    참조 문서

    1. What does this piece of code do in this OpenCV4Android sample application? (CC BY‑SA 2.5/3.0/4.0)

#opencv4android #OpenCV #opencv3.0 #Android






관련 질문

사용 가능한 모든 기기를 지원하는 Android NDK 빌드 (Android NDK build to support all available devices)

안드로이드에서 버튼 클릭시 커스텀 카메라 실행 (custom camera launch on button click in android)

나중에 Android에서 실행해야 하는 데스크탑용 OpenCV 애플리케이션 개발 및 테스트 (Developing and testing an OpenCV application on desktop which should later run on Android)

OpenCV4Android를 사용하여 HSV 이미지의 Value 구성 요소를 해제하여 알고리즘이 조명 조건에 덜 민감해지도록 하려면 어떻게 해야 합니까? (Using OpenCV4Android, how do I dismiss the Value component of an HSV image, so that algorithms become less sensitive to light conditions?)

Hue, Saturation, Value의 수치가 주어지면 색상환을 사용하여 색상의 이름을 말하는 방법 (Given the numerical value of Hue, Saturation and Value, how to tell the name of color using a color wheel)

이 OpenCV4Android 샘플 애플리케이션에서 이 코드는 무엇을 합니까? (What does this piece of code do in this OpenCV4Android sample application?)

opencv를 사용하여 이미지에서 파란색을 감지하려고 시도하고 예기치 않은 결과를 얻습니다. (Trying to detect blue color from image using opencv, and getting unexpected result)

rgba() 메서드에서 반환된 이 Mat가 RGBA 형식이 아닌 BGR 형식으로 나타나는 이유는 무엇입니까? (Why does this Mat returned by rgba() method appear to have BGR format rather than RGBA format?)

파란색에 대해 가능한 전체 Hue 범위를 지정했는데 inRange 함수가 파란색을 감지하지 못하는 이유는 무엇입니까? (Why isn't inRange function detecting blue color when I have given it the entire possible Hue range for the blue color?)

OpenCV는 YUV_420_888 평면에서 3개의 매트 개체를 만듭니다. (OpenCV create 3 mat objects from YUV_420_888 planes)

Bazel을 사용하는 프로젝트에 OpenCV android-sdk를 가져오는 방법은 무엇입니까? (How to import OpenCV android-sdk to my project which is using Bazel?)

Android 애플리케이션의 특정 프레임 내 자동 촬영 기능 (Auto picturing feature within specific frame in Android application)







코멘트