java激光图,java-OpenCV Android跟踪激光点
我正在嘗試在Android設備上使用OpenCV跟蹤激光點.我想使用此激光點在我的cameraview上的畫布上繪制.
我已經將我的camerapreview轉換為HSV色彩空間,并使用閾值過濾(僅在H和V通道上)來分離我的Laserdot.這相當健壯.
public Mat onCameraFrame(CvCameraViewFrame cvf) {
// Grab the video frame
cvf.rgba().copyTo(originalFrame);
cvf.rgba().copyTo(frame);
// Convert it to HSV
Imgproc.cvtColor(frame, frame, Imgproc.COLOR_RGB2HSV);
// Split the frame into individual components (separate images for H, S,
// and V)
mChannels.clear();
Core.split(frame, mChannels); // Split channels: 0-H, 1-S, 2-V
frameH = mChannels.get(0);
// frameS = mChannels.get(1);
frameV = mChannels.get(2);
// Apply a threshold to each component
Imgproc.threshold(frameH, frameH, 155, 160, Imgproc.THRESH_BINARY);
// Imgproc.threshold(frameS, frameS, 0, 100, Imgproc.THRESH_BINARY);
Imgproc.threshold(frameV, frameV, 250, 256, Imgproc.THRESH_BINARY);
// Perform an AND operation
Core.bitwise_and(frameH, frameV, frame);
// Display the result.
frameH.release();
// frameS.release();
frameV.release();
frame.release();
return originalFrame;
}
現在,我試圖獲取激光點中心的坐標.我嘗試在框架上使用findContours函數,但這會導致多個點.
我希望有人能為我指明正確的方向,并提供一些過濾器下一步使用的技巧.
以下是顯示已處理幀的屏幕截圖.
總結
以上是生活随笔為你收集整理的java激光图,java-OpenCV Android跟踪激光点的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 算法与数据结构c语言版PPT,C语言算法
- 下一篇: class传参 python_Pytho