问题
I integrated my project on Visual Studio 2010 with Emgu 3.0 and I'm working on detection object project , but when I'm using MCvFont like the following line I get error because the library is missing , This library is removed from the last version of Emgu or what ?
MCvFont f2 = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_TRIPLEX, 1.0, 1.0);
回答1:
Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_TRIPLEX
can be Emgu.CV.CvEnum.FontFace.HersheyTriplex
in Emgu 3.0.
MCvFont
present in Emgu.CV.Structure
at Emgu_2.4.10,
but it missing at Emgu_3.0.0. I checked this in emgu version history.
You can heal this code by add to reference Emgu.CV from Emgu_2.4.10, catch this dll https://dropmefiles.com/AZvmM
Instruction to convert 2.4.x code to 3.0 can be found http://www.emgu.com/wiki/index.php/Tutorial#Upgrading_from_Emgu_CV_2.x_to_3.x
Do you making face or eyes recognition? This is my first answer at stackoverflow :)
回答2:
I did not want to add an extra dll to have backwards compability with 2.x versions of Emgu for code written in a 3.x version of Emgu. As @Константин Марков points out in his answer, MCvFont is no longer a part of the library in 3.x versions of Emgu.
I am assuming that your final goal is to write some text in an image. So, I you do not mind changing your code, you would need to rewrite it in order to use the method CvInvoke.PutText to accomplish that goal.
According to the official documentation page for the aforementioned method, CvInvoke.PutText
Renders the text in the image with the specified font and color. The printed text is clipped by ROI rectangle. Symbols that do not belong to the specified font are replaced with the rectangle symbol.
This is the method signature in C#
public static void PutText(
IInputOutputArray img,
string text,
Point org,
FontFace fontFace,
double fontScale,
MCvScalar color,
int thickness = 1,
LineType lineType = LineType.EightConnected,
bool bottomLeftOrigin = false
)
Below is a description for each parameter in the method
- img
- Type:
Emgu.CV.IInputOutputArray
- Description: Input image
- Type:
- text
- Type:
System.String
- Description: String to print
- Type:
- org
- Type:
System.Drawing.Point
- Description: Coordinates of the bottom-left corner of the first letter
- Type:
- fontFace
- Type:
Emgu.CV.CvEnum.FontFace
- Description: Font type.
- Type:
- fontScale
- Type:
System.Double
- Description: Font scale factor that is multiplied by the font-specific base size.
- Type:
- color
- Type:
Emgu.CV.Structure.MCvScalar
- Description: Text color
- Type:
- thickness (Optional)
- Type:
System.Int32
- Description: Thickness of the lines used to draw a text.
- Type:
- lineType (Optional)
- Type:
Emgu.CV.CvEnum.LineType
- Description: Line type
- Type:
- bottomLeftOrigin (Optional)
- Type:
System.Boolean
- Description: When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.
- Type:
This is code example taken straight from this source
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.CV.UI;
using System.Drawing;
...
//Create a 3 channel image of 400x200
using (Mat img = new Mat(200, 400, DepthType.Cv8U, 3))
{
img.SetTo(new Bgr(255, 0, 0).MCvScalar); // set it to Blue color
//Draw "Hello, world." on the image using the specific font
CvInvoke.PutText(
img,
"Hello, world",
new System.Drawing.Point(10, 80),
FontFace.HersheyComplex,
1.0,
new Bgr(0, 255, 0).MCvScalar);
//Show the image using ImageViewer from Emgu.CV.UI
ImageViewer.Show(img, "Test Window");
}
回答3:
CvInvoke.PutText(img,
"Hello, world",
new System.Drawing.Point(10, 80),
FontFace.HersheyComplex, 1.0,
new Bgr(0, 255, 0).MCvScalar);
reference: http://www.emgu.com/wiki/index.php/Hello_World_in_CSharp#Emgu_CV_3.0_2
来源:https://stackoverflow.com/questions/34935053/mcvfont-library-is-missing-at-emgu-3-0