I want to use opencv and there is an error
I think that during template matching, occur error.
- Blueprint
Beginplay → CVTest(this is custom function) → print string
Press play button than the engine is stop and show crash Reporter.
—This is error message (crash Reporter)
MachineId:7B238C0C4F6D04C0206170988C1665F2
EpicAccountId:d09fd393511045b69e6e72a450867ec1
Unknown exception - code c06d007e (first/second chance not available)
KERNELBASE
UE4Editor_openTest_2421!__delayLoadHelper2() [f:\dd\vctools\delayimp\delayhlp.cpp:323]
UE4Editor_openTest_2421!_tailMerge_opencv_world300_dll()
UE4Editor_openTest_2421!AMyActor::CVTest() [e:\_unrealworkspace\opentest\source\opentest\myactor.cpp:36]
UE4Editor_openTest_2421!AMyActor::execCVTest() [e:\_unrealworkspace\opentest\source\opentest\myactor.h:12]
UE4Editor_CoreUObject!UFunction::Invoke() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\class.cpp:4474]
UE4Editor_CoreUObject!UObject::CallFunction() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:700]
UE4Editor_CoreUObject!UObject::ProcessContextOpcode() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:2139]
UE4Editor_CoreUObject!UObject::execLet() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1938]
UE4Editor_CoreUObject!UObject::ProcessInternal() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:925]
UE4Editor_CoreUObject!UObject::CallFunction() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:824]
UE4Editor_CoreUObject!UObject::execVirtualFunction() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:2245]
UE4Editor_CoreUObject!UObject::ProcessInternal() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:925]
UE4Editor_CoreUObject!UFunction::Invoke() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\class.cpp:4474]
UE4Editor_CoreUObject!UObject::ProcessEvent() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1308]
UE4Editor_Engine!AActor::ProcessEvent() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\actor.cpp:649]
UE4Editor_Engine!AActor::BeginPlay() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\actor.cpp:3048]
UE4Editor_Engine!AWorldSettings::NotifyBeginPlay() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\worldsettings.cpp:175]
UE4Editor_Engine!AGameStateBase::HandleBeginPlay() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\gamestatebase.cpp:177]
UE4Editor_Engine!UWorld::BeginPlay() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\world.cpp:3358]
UE4Editor_Engine!UGameInstance::StartPIEGameInstance() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\gameinstance.cpp:282]
UE4Editor_UnrealEd!UEditorEngine::CreatePIEGameInstance() [d:\build\++ue4+release-4.14+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:3358]
UE4Editor_UnrealEd!UEditorEngine::PlayInEditor() [d:\build\++ue4+release-4.14+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:2462]
UE4Editor_UnrealEd!UEditorEngine::StartQueuedPlayMapRequest() [d:\build\++ue4+release-4.14+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:1160]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build\++ue4+release-4.14+compile\sync\engine\source\editor\unrealed\private\editorengine.cpp:1320]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build\++ue4+release-4.14+compile\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:371]
UE4Editor!FEngineLoop::Tick() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2859]
UE4Editor!GuardedMain() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\launch\private\launch.cpp:152]
UE4Editor!GuardedMainWrapper() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
kernel32
ntdll
–MyActor.h
#pragma once
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"
UCLASS()
class OPENTEST_API AMyActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AMyActor();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
UFUNCTION(BlueprintCallable, Category = "Something")
static float CVTest();
};
–MyActor.cpp
#include "openTest.h"
#include "MyActor.h"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
Mat img, templ, mask, result;
// Sets default values
AMyActor::AMyActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
float AMyActor::CVTest() {
img = imread("E:\\CJH\\Desktop\\DetectingTectImg\\1.jpg", IMREAD_COLOR);
templ = imread("E:\\CJH\\Desktop\\DetectingTectImg\\t1.jpg", IMREAD_COLOR);
int result_cols = img.cols - templ.cols + 1;
int result_rows = img.rows - templ.rows + 1;
result.create(result_rows, result_cols, CV_32FC1);
matchTemplate(img, templ, result, CV_TM_CCORR_NORMED);
normalize(result, result, 0, 1, NORM_MINMAX, -1, Mat());
double minVal, maxVal;
Point minLoc, maxLoc, matchLoc;
minMaxLoc(result, &minVal, &maxVal, &minLoc, &maxLoc, Mat());
return maxVal;
}
I wish to get a value of the template match was well done or not.
Please help me…
p.s. Sorry for my English skill…