Cannot load MyProject2 module after editing MyProject2HUD.h and MyProject2HUD.cpp

Hi everyone. My goal is trying to create a simple mixed reality game, using the camera of my Android smartphone. I’ve searched the Internet for how to make this project working and I found out that I can achieve the goal by printing continuosly the images grabbed from the camera over the rendered frame. I thought I can do this using the HUD. But if I try to edit MyProject2HUD.h and MyProject2HUD.cpp and compile, I cannot anymore load the game module. There is someone who can hint me what I’m doing wrong?

I explain what shuold do:
The function initializeView(ViewMode vm) creates the references, using OpenCV, to the camera (cameras if working with VR). ViewMode is an enum written in the global scope.

In the DrawHUD function I’ve added the following functionality:
1.- it gets the image from the camera
2.- It gets from the image the coordinates relatives to face/people recognition
3.- The relatives areas are then printed over a UTexture2D element and then printed over the HUD

What am I doing wrong?
At least can I get the thing working without touching this code?

Thank You very much

Here is The code I’m working on:

AMyProject2HUD::AMyProject2HUD()
{
// Set the crosshair texture
static ConstructorHelpers::FObjectFinder CrosshiarTexObj(TEXT("/Game/FirstPerson/Textures/FirstPersonCrosshair"));
CrosshairTex = CrosshiarTexObj.Object;

initializeViewMode(MONO);

}

int AMyProject2HUD::initializeViewMode(ViewMode vm) {

if (vm == STEREO) {

	rightvc = VideoCapture("");
	if (!rightvc.isOpened()) return 1;

	leftvc = VideoCapture("");
	if (!leftvc.isOpened()) return 2;

}
else {

	rightvc = VideoCapture("/dev/bus/usb/001/002");
	if (!rightvc.isOpened()) return 1;

	cc = CascadeClassifier();

}

return 0;

}

void AMyProject2HUD::DrawHUD()
{
Super::DrawHUD();

// Draw very simple crosshair

// find center of the Canvas
const FVector2D Center(Canvas->ClipX * 0.5f, Canvas->ClipY * 0.5f);

// offset by half the texture's dimensions so that the center of the texture aligns with the center of the Canvas
const FVector2D CrosshairDrawPosition((Center.X),
	(Center.Y + 20.0f));

// draw the crosshair
FCanvasTileItem TileItem(CrosshairDrawPosition, CrosshairTex->Resource, FLinearColor::White);
TileItem.BlendMode = SE_BLEND_Translucent;
Canvas->DrawItem(TileItem);

if (cvm == MONO) {

	//Gets the frame
	rightvc.read(rightFrame);

	rightmatches = std::vector<cv::Rect>();



	cc.detectMultiScale(
		rightFrame //const Mat&
				   //Matrix of the type CV_8U containing an image where objects are detected.
		, rightmatches // vector<Rect>& objects
					   //Vector of rectangles where each rectangle contains the detected object.
		, 1.05  //double scale = 1.05
				//scale0 – Coefficient of the detection window increase.
				//scaleFactor - Parameter specifying how much the image size is reduced at each image scale.

		, 3, 6
		, Size(8, 8)//winSize
					//win_stride – Window stride. It must be a multiple of block stride
		, Size(32, 32)//padding
					  //padding – Mock parameter to keep the CPU interface compatibility. It must be (0,0). 
					  //, 0.0  //group_threshold=2
					  //group_threshold – Coefficient to regulate the similarity threshold. When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. See groupRectangles() .
	);

	size_t i, j;




	for (i = 0; i < rightmatches.size(); i++)
	{
		cv::Rect r = rightmatches[i];
		for (j = 0; j < rightmatches.size(); j++) {
			//filter out overlapping rectangles
			if (j != i) {
				cv::Rect iRect = r;
				cv::Rect jRect = rightmatchesFiltered[j];
				cv::Rect intersectRect = (iRect & jRect);
				if (intersectRect.area() >= iRect.area()*0.9) break;
			}
		}
		if (j == rightmatches.size())
			rightmatchesFiltered.push_back(r);
	}
	for (i = 0; i < rightmatchesFiltered.size(); i++)
	{
		cv::Rect r = rightmatchesFiltered[i];
		// the HOG detector returns slightly larger rectangles than the real objects.
		// so we slightly shrink the rectangles to get a nicer output.
		r.x += cvRound(r.width*0.5); //offset di partenza
									 // hacky shift right by 40px - rects seem to be shifted consistently
		r.x += -40;
		r.width = cvRound(r.width*0.3);
		r.y += cvRound(r.height*0.07); //offset di partenza
		r.height = cvRound(r.height*0.8);
	}
	//eliminate overlaps

	for (i = 0; i < rightmatchesFiltered.size(); i++) {

		Mat undermat = rightFrame(rightmatchesFiltered[i]).clone();

		finaltexture = UTexture2D::CreateTransient(undermat.size().width, undermat.size().height);
		FTexture2DMipMap &mip = finaltexture->PlatformData->Mips[0];

		void *data = mip.BulkData.Lock(LOCK_READ_WRITE);
		auto stride = (int32)(sizeof(uint8) * 4); // for r, g, b, a
		FMemory::Memcpy(data, undermat.data, undermat.size().width * undermat.size().height * stride);

		mip.BulkData.Unlock();
		finaltexture->UpdateResource();

		AHUD::DrawTextureSimple(finaltexture, rightmatchesFiltered[i].x, rightmatchesFiltered[i].y, 1, true);
	}

}

}

I’ve figured out what is the problem: I’ve created a new HUD class using the wizard from the editor and turns out that if I create objects from non-unreal classes and use OS-specific header files, it fails to load the game module. I have to do this because I need to use OpenCV functionality for creating elements to draw to the HUD. is there a way to deal with this problem or I have to find another way?