홈>
웹캠에서 원을 감지하기 위해 emguCV를 사용하려고합니다. 나는 그것에 대한 경험이 없으며 이것은 처음입니다. 이 튜토리얼 https://www.youtube.com/watch?v=vdjoutNR2DQ를 따르려고합니다. 그러나 다른 버전을 사용하고있는 것 같습니다
-라인 168 오류 : Emgu.CV.Mat '유형을'Emgu.CV.Image '로 암시 적으로 변환 할 수 없습니다
-171 행에서 오류 'Emgu.CV.Image'유형을 'Emgu.CV.Image'로 암시 적으로 변환 할 수 없습니다
-In line 173 Error : 'Emgu.CV.Image.HoughCircles (Emgu.CV.Structure.Bgr, Emgu.CV.Structure.Bgr, double, double, int, int)'에 대한 가장 오버로드 된 메소드 일치 잘못된 인수들
-같은 줄에 173 오류 : Argument 1&2 : 'Emgu.CV.Structure.Gray'에서 'Emgu.CV.Structure.Bgr로 변환 할 수 없습니다
이것들은 emguCV에서 사용하고있는 참고 문헌입니다
이것은 코드입니다
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.CV.UI;
namespace videosearch
{
public partial class detect : Form
{
Capture cp = null;
bool blac = false;
Image<Bgr, byte> imageorgnal;
Image<Bgr, byte> imgproc;
public detect()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (blac == true)
{
Application.Idle -= procframdatGUI;
blac = false;
button1.Text = "Resume";
}
else
{
Application.Idle += procframdatGUI;
button1.Text = "pause";
blac = true;
}
}
private void detect_Load(object sender, EventArgs e)
{
try
{
cp = new Capture(Emgu.CV.CvEnum.CaptureType.DShow);
}
catch (NullReferenceException ex)
{
MessageBox.Show(ex.Message);
return;
}
Application.Idle += procframdatGUI;
blac = true;
}
private void detect_Close(object sender, FormClosedEventArgs e)
{
if (cp!=null)
{
cp.Dispose();
}
}
void procframdatGUI(object sender, EventArgs e)
{
imageorgnal = cp.QueryFrame();//line 168 Error: Cannot implicitly convert type Emgu.CV.Mat'to 'Emgu.CV.Image<Emgu.CV.Structure.Bgr,byte>'
if (imageorgnal == null)
return;
imgproc = imageorgnal.InRange(new Bgr(0, 0, 175), new Bgr(100, 100, 256));// line 171 Error Cannot implicitly convert type 'Emgu.CV.Image<Emgu.CV.Structure.Gray,byte>' to 'Emgu.CV.Image<Emgu.CV.Structure.Bgr,byte>'
imgproc = imgproc.SmoothGaussian(9);
CircleF[] cir = imgproc.HoughCircles(new Gray(100), new Gray(50), 2, imgproc.Height / 4, 10, 400); //In line 173 Error: The best overloaded method match for 'Emgu.CV.Image<Emgu.CV.Structure.Bgr,byte>.HoughCircles(Emgu.CV.Structure.Bgr, Emgu.CV.Structure.Bgr,double, double, int, int)' has some invalid arguments
// in same line Error :Argument 1 &2: cannot convert from 'Emgu.CV.Structure.Gray' to 'Emgu.CV.Structure.Bgr'
foreach (CircleF ci in cir)
{
if (textBox1.Text!="")
{
textBox1.AppendText(Environment.NewLine);
}
textBox1.AppendText("ball position x=" + ci.Center.X.ToString().PadLeft(4) + "\n Y= " + ci.Center.Y.ToString().PadLeft(4)+ "\n ridius"+ci.Radius.ToString("###.000").PadLeft(7));
textBox1.ScrollToCaret();
CvInvoke.Circle(imgproc, new Point((int)ci.Center.X, (int)ci.Center.Y), 3, new MCvScalar(0, 255, 0), -1, 0, 0);
imageorgnal.Draw(ci, new Bgr(Color.Red), 3);
}
imageBox1.Image = imageorgnal;
imageBox2.Image = imgproc;
}
}
}
-
답변 # 1
관련 자료
- python - '순서없이 인수를 구문 분석 할 수 없음'인수에 대한 오류를 해결하려면 어떻게해야합니까?
- ggplot2 - R의 이진 연산에 대한 비 숫자 인수 오류, 설명 필요
- linux - mysql이 시작되지 않습니다오류 - su : 경고 : 디렉토리를/nonexistent로 변경할 수 없음 : 해당 파일 또는 디렉토리가 없습니다
- node.js - 오류 [err_http_headers_sent] - api 요청시 클라이언트로 전송 된 후 헤더를 설정할 수 없습니다
- javascript - API에서 데이터를 가져 오는 React에서 정의되지 않은 속성을 읽을 수 없음 오류가 발생합니다
- javascript - 첫 번째 렌더링에서 null 오류의 속성 '값'을 읽을 수 없습니다
- swift - Cocoapods를 설치할 수 없습니다 계속 오류가 발생합니다
- angular - 오류 - usercomponent에서 정의되지 않은 'id'속성을 설정할 수 없습니다
- html - 정의되지 않은 '길이'속성을 읽을 수 없습니다자바 스크립트 오류
- javascript - 오류 - 'react-dev-utils/inquirer'모듈을 찾을 수 없습니다
- reactjs - 함수에 암시 적으로 반환 유형 '모든'오류가 있습니다
- javascript - 반응 - promise with edge를 사용할 때 오류를 구문 분석 할 수 없습니다
- c# - Unity에서 "컴포지트에서 Vector2 유형의 값을 읽을 수 없음"오류를 어떻게 해결할 수 있습니까?
- c# - Unity에서 "컴포지트에서 Vector2 유형의 값을 읽을 수 없음"오류를 어떻게 해결할 수 있습니까?
- javascript - 정의되지 않은 오류의 '맵'속성을 읽을 수 없습니다 React Typescript
- c# - 'SystemCollectionsGenericList '형식을 암시 적으로 변환 할 수 없습니다
- vue.js - null의 'title'속성을 읽을 수 없습니다nuxtjs의 오류 메시지
- javascript - @ rollup/plugin-node-resolve에서 오류 발생 - 정의되지 않은 '길이'속성을 읽을 수 없습니다
- r - fun (x [[i]],…) 오류 - 찌르는 인수의 잘못된 '유형'(문자)
- flutter - NewsAPi 오류는 화면에 아무것도 표시 할 수 없지만 실제로 콘솔에서 데이터를 얻고 있습니다
트렌드
- OpenCv의 폴더에서 여러 이미지 읽기 (python)
- 파이썬 셀레늄 모든 "href"속성 가져 오기
- git commit - 자식 - 로컬 커밋 된 파일에 대한 변경을 취소하는 방법
- html - 자바 스크립트 - 클릭 후 변경 버튼 텍스트 변경
- JSP에 대한 클래스를 컴파일 할 수 없습니다
- javascript - 현재 URL에서 특정 div 만 새로 고침/새로 고침
- jquery - JavaScript로 현재 세션 값을 얻으시겠습니까?
- javascript - swiperjs에서 정지, 재생 버튼 추가
- vue.js - axios를 사용하여 서버에 이미지를 업로드하는 방법
- python - 문자열에서 특정 문자 제거
문제를 해결했다고 생각합니다
168 행의 문제 오류 : Emgu.CV.Mat '유형을'Emgu.CV.Image '로 암시 적으로 변환 할 수 없습니다.
171 행의 문제에 대한 오류 오류 'Emgu.CV.Image'유형을 'Emgu.CV.Image'로 암시 적으로 변환 할 수 없습니다. 이미지의 초기화를 변경합니다내가 한 것은 캡처를 사용하는 대신 파일에서 이미지를 가져 오는 것입니다
173 행의 문제를 해결함으로써 오류 : Argument 1&2 : 'Emgu.CV.Structure.Gray'에서 'Emgu.CV.Structure.Bgr'로 변환 할 수 없습니다 그런 다음 173 줄의 문제를 해결하기 위해 [0]을 추가합니다.
따라서 변경 한 후이 코드를 변경 한 후