public Form1() { InitializeComponent(); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); m_Rasterizer = new PDFRasterizer(m_StrProductKey); m_Creator = new PDFCreator(m_StrProductKey); toolStripCbxPen.SelectedIndex = 0; toolStripCbxFont.SelectedIndex = 0; dsViewer1.Annotation.Type = Dynamsoft.Forms.Enums.EnumAnnotationType.enumPointer; dsViewer1.SetViewMode(1, 1); string imagePath = Application.ExecutablePath; imagePath = imagePath.Replace("/", "\\"); string strDllFolder = imagePath; int pos = imagePath.LastIndexOf("\\Samples\\"); if (pos != -1) { imagePath = imagePath.Substring(0, imagePath.IndexOf(@"\", pos)) + @"\Samples\Bin\Images\AnnotationImage\Annotation Sample Image.png"; } else { imagePath = Application.StartupPath + @"\Bin\Images\AnnotationImage\Annotation Sample Image.png"; } m_ImageCore.IO.LoadImage(imagePath); dsViewer1.Annotation.OnAnnotationTextChanged += Annotation_OnAnnotationTextChanged; dsViewer1.Annotation.OnAnnotationSelected += Annotation_OnAnnotationSelected; dsViewer1.Annotation.OnAnnotationDeselected += Annotation_OnAnnotationDeselected; }
public Form1() { InitializeComponent(); m_TwainManager = new TwainManager(m_StrProductKey); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); this.txtboxServer.Text = m_strServerName; this.txtboxPort.Text = m_strPort; this.txtboxActionPage.Text = m_strActionPage; this.txtboxFileName.Text = "DNT_Image"; this.rdbtnJPEG.Checked = true; this.chkboxMultiPage.Enabled = false; int lngNum; m_TwainManager.OpenSourceManager(); for (lngNum = 0; lngNum < m_TwainManager.SourceCount; lngNum++) { cmbSource.Items.Add(m_TwainManager.SourceNameItems(Convert.ToInt16(lngNum))); // display the available imaging devices } if (lngNum > 0) { cmbSource.SelectedIndex = 0; } }
private void profile_photo_Click(object sender, EventArgs e) { Formwebcam fwbcm = new Formwebcam(); fwbcm.Show(); ImageCore m_ImageCore = new ImageCore(); }
public Form1() { InitializeComponent(); this.StartPosition = FormStartPosition.Manual; this.Location = new Point(0, 0); m_CameraManager = new CameraManager(m_StrProductKey); m_ImageCore = new ImageCore(); //JWB not used //dsViewer1.Bind(m_ImageCore); this.Load += new EventHandler(Form1_Load); //The stuff Matt added to the example, uses picture boxes instead of dynamsoft controls InitializeLeftRight(); m_pb1_width = pictureBox1.Width; m_pb1_height = pictureBox1.Height; m_pb1_loc = pictureBox1.Location; save_rpbl = pictureBox_Right.Location; save_lpbl = pictureBox_Left.Location; textBoxDate.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm"); ZoomRight_X = 1080F / m_pb1_width; ZoomRight_Y = 810F / m_pb1_height; ZoomLeft_X = 1080F / m_pb1_width; ZoomLeft_Y = 810F / m_pb1_height; //attemps to control the dynamstoft controls, picturebox was just way more straightforward //Init_Unused(); } //end form1
public Form1() { InitializeComponent(); m_TwainManager = new TwainManager(m_StrProductKey); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); if (m_TwainManager.SourceCount > 0) { for (short i = 0; i < m_TwainManager.SourceCount; i++) { string strSourceName = m_TwainManager.SourceNameItems(i); if (strSourceName != null) { cbxSources.Items.Add(strSourceName); } } cbxSources.SelectedIndexChanged += cbxSources_SelectedIndexChanged; cbxSources.SelectedIndex = 0; } else { MessageBox.Show(this, "There is no scanner detected!\n " + "Please ensure that at least one (virtual) scanner is installed.", "Information"); return; } }
public Form1() { InitializeComponent(); m_ImageCore = new ImageCore(); m_TwainManager = new TwainManager(m_StrProductKey); dsViewer1.Bind(m_ImageCore); }
public Form1() { InitializeComponent(); m_CameraManager = new CameraManager(m_StrProductKey); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); this.Load += new EventHandler(Form1_Load); }
public static Offer Map(Item item) { var offer = item.Map <Offer>(); offer.Thumbnail = ImageCore.Cdn(item.PrimaryImageThumbnail); offer.LargeImage = ImageCore.Cdn(item.PrimaryImageLarge); offer.OwnerPicture = item.OwnerPicture; return(offer); }
public static Want Map(ItemRequest itemRequest) { var want = itemRequest.Map <Want>(); want.Thumbnail = ImageCore.Cdn(itemRequest.PrimaryImageThumbnail); want.LargeImage = ImageCore.Cdn(itemRequest.PrimaryImageLarge); want.OwnerPicture = itemRequest.OwnerPicture; return(want); }
public OCRHelper() { languages.Add("English", "eng"); m_strCurrentDirectory = AppDomain.CurrentDomain.BaseDirectory; m_Tesseract = new Tesseract(m_StrProductKey); m_ImageCore = new ImageCore(); m_PDFRasterizer = new PDFRasterizer(m_StrProductKey); tempListSelectedBitmap = new List <Bitmap>(); }
public static ApiActivity Map(Activity r) { var activity = r.Map <ApiActivity>(); activity.LargeImage = ImageCore.LargeCdn(r.ImagePathFormat); activity.Thumbnail = ImageCore.ThumbnailCdn(r.ImagePathFormat); activity.UserPicture = FacebookCore.Picture(r.UserFacebookId).ToString(); return(activity); }
public Form1() { InitializeComponent(); InitializeUI(); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); dsViewer1.OnImageAreaSelected += viewer1_OnImageAreaSelected; dsViewer1.OnImageAreaDeselected += viewer1_OnImageAreaDeselected; m_PDFRasterizer = new PDFRasterizer(m_StrProductKey); }
public void GenerateOCR(OcrAttchmentModel ocrAttModel, string sourcePath, string fileName) //, string targetPath { byte[] sbytes = null; string languageFolder = ConfigurationManager.AppSettings["Tessdata"]; LogUtility.WriteToFile("OCR Utility Process Path:" + languageFolder); //m_strCurrentDirectory + ConfigurationManager.AppSettings["Tessdata"]; // "\\OCR\\tessdata"; m_Tesseract = new Tesseract(m_StrProductKey); m_ImageCore = new ImageCore(); m_PDFRasterizer = new PDFRasterizer(m_StrProductKey); tempListSelectedBitmap = new List <System.Drawing.Bitmap>(); m_Tesseract.TessDataPath = languageFolder; m_Tesseract.Language = languages["English"]; m_Tesseract.ResultFormat = ResultFormat.Text; string imageFolder = sourcePath; string testPath = string.Empty; if (sourcePath.Contains(".pdf")) { m_PDFRasterizer.ConvertMode = Dynamsoft.PDF.Enums.EnumConvertMode.enumCM_AUTO; m_PDFRasterizer.ConvertToImage(imageFolder, "", 200, this as IConvertCallback); } else { m_ImageCore.IO.LoadImage(imageFolder); } int imgCount = m_ImageCore.ImageBuffer.HowManyImagesInBuffer; List <short> lstindexs = new List <short>(); for (short index = 0; index < imgCount; index++) { if (index >= 0 && index < m_ImageCore.ImageBuffer.HowManyImagesInBuffer) { if (tempListSelectedBitmap == null) { tempListSelectedBitmap = new List <Bitmap>(); } Bitmap temp = m_ImageCore.ImageBuffer.GetBitmap(index); tempListSelectedBitmap.Add(temp); lstindexs.Add(index); } } if (tempListSelectedBitmap != null) { sbytes = m_Tesseract.Recognize(tempListSelectedBitmap); } if (sbytes != null && sbytes.Length > 0) { LogUtility.WriteToFile("OCR Processing File Name:" + fileName); SaveOCRBlob(ocrAttModel, fileName, sbytes); } }
public Form1() { InitializeComponent(); m_Tesseract = new Tesseract(m_StrProductKey); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); m_PDFRasterizer = new PDFRasterizer(m_StrProductKey); dsViewer1.OnImageAreaSelected += new Dynamsoft.Forms.Delegate.OnImageAreaSelectedHandler(dsViewer1_OnImageAreaSelected); dsViewer1.OnImageAreaDeselected += dynamicDotNetTwain1_OnImageAreaDeselected; dsViewer1.OnMouseClick += dynamicDotNetTwain1_OnImageAreaDeselected; }
public Form1() { InitializeComponent(); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); Initialization(); m_Generator = new Dynamsoft.Barcode.BarcodeGenerator(m_StrProductKey); m_PDFCreator = new PDFCreator(m_StrProductKey); m_PDFRasterizer = new PDFRasterizer(m_StrProductKey); }
public WebCam(FrmHC128 home) { InitializeComponent(); Home = home; m_CameraManager = new CameraManager(m_StrProductKey); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); this.Load += new EventHandler(Form1_Load); }
public Window1() { InitializeComponent(); m_ImageCore = new ImageCore(); dSViewer1.Bind(m_ImageCore); m_CameraManager = new CameraManager(m_StrProductKey); this.cbxSources.SelectionChanged += cbxSources_SelectionChanged; cbxSources.SelectedIndex = 0; this.Loaded += new RoutedEventHandler(Window1_Loaded); this.cbxSources.SelectionChanged += new SelectionChangedEventHandler(cbxSources_SelectionChanged); }
private void InitialiseAndStartWebCam() { //Initialise the webcamera and start m_CameraManager = new CameraManager("t0068MgAAALy2+1uzMH3do0eStkxwYPt8igdrUGRffaUDbP8qgfsa+K8waVxspoiiFvfyFNcuWorQR1uXAoOCvPJ3eKcLELE="); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); if (m_CameraManager.GetCameraNames() != null) { m_CurrentCamera = m_CameraManager.SelectCamera(0); m_CurrentCamera.SetVideoContainer(pictureBox1.Handle); m_CurrentCamera.Open(); } }
public Form1() { InitializeComponent(); Initialization(); m_PDFRasteizer = new Dynamsoft.PDF.PDFRasterizer(m_StrProductKey); m_PDFCreator = new PDFCreator(m_StrProductKey); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); chbMultiPagePDF.Checked = false; chbMultiPagePDF.Enabled = false; chbMultiPageTIFF.Checked = false; chbMultiPageTIFF.Enabled = false; }
public Form1() { InitializeComponent(); m_CameraManager = new CameraManager(m_StrProductKey); m_ImageCore = new ImageCore(); Red.BackColor = Color.Black; Yellow.BackColor = Color.Black; Green.BackColor = Color.Black; this.Load += new EventHandler(Form1_Load); }
public Form1() { InitializeComponent(); m_TwainManager = new TwainManager(m_StrProductKey); m_ImageCore = new ImageCore(); dsViewer1.Bind(m_ImageCore); dsViewer1.SetViewMode(1, 1); BMPradio.Checked = true; sImageType = 0; MultiTIFF.Enabled = false; MultiPDF.Enabled = false; m_PDFCreator = new PDFCreator(m_StrProductKey); m_RefreshInfo = new RefreshInfo(ShowImageInfo); }
public Window1() { InitializeComponent(); m_ImageCore = new ImageCore(); dSViewer1.Bind(m_ImageCore); m_CameraManager = new CameraManager(m_StrProductKey); this.cbxSources.SelectionChanged += cbxSources_SelectionChanged; cbxSources.SelectedIndex = 0; this.Loaded += new RoutedEventHandler(Window1_Loaded); this.cbxSources.SelectionChanged += new SelectionChangedEventHandler(cbxSources_SelectionChanged); btnRotate90.Background = new ImageBrush(new BitmapImage(new Uri(imageDirectory + "90_normal.png", UriKind.RelativeOrAbsolute))); btnRotate180.Background = new ImageBrush(new BitmapImage(new Uri(imageDirectory + "180_normal.png", UriKind.RelativeOrAbsolute))); btnRotate270.Background = new ImageBrush(new BitmapImage(new Uri(imageDirectory + "270_normal.png", UriKind.RelativeOrAbsolute))); m_Refresh += new RefreshDelegate(RefreshImage); m_ControlWindow = Window.GetWindow(image1); }
public void SetThumbnail(string data) { if (!string.IsNullOrWhiteSpace(data)) { switch (this.Type) { case Reference.User: case Reference.Company: this.Thumbnail = FacebookCore.Picture(long.Parse(data)).ToString(); break; case Reference.ItemRequest: case Reference.Item: this.Thumbnail = ImageCore.ThumbnailCdn(data); break; } } }
public Window1() { InitializeComponent(); m_CoreForImageViewer = new ImageCore(); m_CoreForImageThum = new ImageCore(); m_TwainManager = new TwainManager(m_StrProductKey); dsViewer.Bind(m_CoreForImageViewer); dsViewerThum.Bind(m_CoreForImageThum); m_PDFRasterizer = new PDFRasterizer(m_StrProductKey); m_PDFCreator = new PDFCreator(m_StrProductKey); m_Tesseract = new Tesseract(m_StrProductKey); try { dpTitle.Background = new ImageBrush(new BitmapImage(new Uri(imageDirectory + "title.png", UriKind.RelativeOrAbsolute))); IconBitmapDecoder ibd = new IconBitmapDecoder( new Uri(imageDirectory + "dnt_demo_icon.ico", UriKind.RelativeOrAbsolute), BitmapCreateOptions.None, BitmapCacheOption.Default); this.Icon = ibd.Frames[0]; } catch { } dpTitle.MouseLeftButtonDown += new MouseButtonEventHandler(MoveWindow); dsViewerThum.MouseShape = true; dsViewerThum.SetViewMode(1, 4); dsViewerThum.AllowMultiSelect = true; dsViewerThum.OnMouseClick += new OnMouseClickHandler(dsViewerThum_OnMouseClick); dsViewerThum.EnableKeyboardInteractive = false; dsViewerThum.OnViewerKeyDown += new KeyEventHandler(dsViewerThum_OnViewerKeyDown); string dynamicDotNetTwainDirectory = strCurrentDirectory; int index = System.Reflection.Assembly.GetExecutingAssembly().Location.IndexOf("Samples"); dsViewer.MouseShape = false; dsViewer.SetViewMode(-1, -1); m_CoreForImageViewer.ImageBuffer.MaxImagesInBuffer = 1; }
/// <summary> /// Adds events and objects for drawing lines on the right and left pictureboxes /// </summary> public void InitializeLeftRight() { // pictureBox_Right.Width = m_picureBox_Width; // pictureBox_Right.Height = m_pictureBox_Height; // pictureBox_Left.Width = m_picureBox_Width; // pictureBox_Left.Height = m_pictureBox_Height; ZoomFactor = 980.0F / (float)pictureBox_Right.Width; m_LeftImage = new ImageCore(); m_RightImage = new ImageCore(); //dsViewerLeft.Bind(m_LeftImage); // dsViewerRight.Bind(m_RightImage); Line line_Left = null; var lines_Left = new List <Line>(); Line line_Right = null; var lines_Right = new List <Line>(); //left box pictureBox_Left.MouseMove += (s, e) => { if (e.Button == MouseButtons.Left) { line_Left.End = e.Location; pictureBox_Left.Invalidate(); } }; pictureBox_Left.MouseDown += (s, e) => { if (lines_Left.Count == 2) { lines_Left = new List <Line>(); //reset the lines } if (e.Button == MouseButtons.Left) { line_Left = new Line { Start = e.Location, End = e.Location } } ; Debug.WriteLine(line_Left); }; pictureBox_Left.MouseUp += (s, e) => { if (e.Button == MouseButtons.Left) { lines_Left.Add(line_Left); } if (lines_Left.Count == 2) { //Double Angle = Math.Atan2(y2 - y1, x2 - x1) - Math.Atan2(y4 - y3, x4 - x3); //Double Angle = Math.Atan2(lines[0].End.Y - lines[0].Start.Y, lines[0].End.X - lines[0].Start.X) - Math.Atan2(lines[1].End.Y - lines[1].Start.Y, lines[1].End.X - lines[1].Start.X); //Double deltaY = Math.Abs((lines_Left[0].End.Y - lines_Left[0].Start.Y)); //could simplify the angle to a positive integer Double A1 = Math.Atan2(lines_Left[0].End.Y - lines_Left[0].Start.Y, lines_Left[0].End.X - lines_Left[0].Start.X); Double A2 = Math.Atan2(lines_Left[1].End.Y - lines_Left[1].Start.Y, lines_Left[1].End.X - lines_Left[1].Start.X); A1 = A1 * 180 / Math.PI; A2 = A2 * 180 / Math.PI; Double angle = A1 - A2; angle = Math.Round(angle, 1); angle = Math.Abs(angle); //Double Angle_deg = Angle * 180 / Math.PI; if (angle > 90) { angle = 180 - angle; } lbl_LeftAngle.Text = "Left Angle = " + angle.ToString(); // lines_Left = new List<Line>();//reset the lines = this erased lines before printing - now done on mouse down //line_Left = null; } }; // ************************* // Left Picture Box paint // **************************** pictureBox_Left.Paint += (s, e) => { if (ZoomFlagL == false) { if (line_Left != null) { e.Graphics.DrawLine(pen, line_Left.Start.X / ZoomLeft_X, line_Left.Start.Y / ZoomLeft_Y, line_Left.End.X / ZoomLeft_X, line_Left.End.Y / ZoomLeft_Y); } foreach (var l in lines_Left) { e.Graphics.DrawLine(pen, l.Start.X / ZoomLeft_X, l.Start.Y / ZoomLeft_Y, l.End.X / ZoomLeft_X, l.End.Y / ZoomLeft_Y); } } else { if (line_Left != null) { e.Graphics.DrawLine(pen, line_Left.Start, line_Left.End); } foreach (var l in lines_Left) { e.Graphics.DrawLine(pen, l.Start, l.End); // Debug.WriteLine("lines " + l.Start.X); } } /* original unscaled version * if (line_Left != null) * e.Graphics.DrawLine(pen, line_Left.Start, line_Left.End); * * foreach (var l in lines_Left) * e.Graphics.DrawLine(pen, l.Start, l.End); */ }; //right box pictureBox_Right.MouseMove += (s, e) => { if (e.Button == MouseButtons.Left) { line_Right.End = e.Location; pictureBox_Right.Invalidate(); } }; pictureBox_Right.MouseDown += (s, e) => { if (lines_Right.Count == 2) { lines_Right = new List <Line>(); //reset the lines } if (e.Button == MouseButtons.Left) { line_Right = new Line { Start = e.Location, End = e.Location } } ; }; pictureBox_Right.MouseUp += (s, e) => { if (e.Button == MouseButtons.Left) { lines_Right.Add(line_Right); } if (lines_Right.Count == 2) { //Double Angle = Math.Atan2(y2 - y1, x2 - x1) - Math.Atan2(y4 - y3, x4 - x3); //Double Angle = Math.Atan2(lines[0].End.Y - lines[0].Start.Y, lines[0].End.X - lines[0].Start.X) - Math.Atan2(lines[1].End.Y - lines[1].Start.Y, lines[1].End.X - lines[1].Start.X); Double A1 = Math.Atan2(lines_Right[0].End.Y - lines_Right[0].Start.Y, lines_Right[0].End.X - lines_Right[0].Start.X); Double A2 = Math.Atan2(lines_Right[1].End.Y - lines_Right[1].Start.Y, lines_Right[1].End.X - lines_Right[1].Start.X); A1 = A1 * 180 / Math.PI; A2 = A2 * 180 / Math.PI; Double angle = A1 - A2; angle = Math.Round(angle, 1); angle = Math.Abs(angle); //Double Angle_deg = Angle * 180 / Math.PI; if (angle > 90) { angle = 180 - angle; } lbl_RightAngle.Text = "Right Angle = " + angle.ToString(); // lines_Right = new List<Line>(); //reset the lines //line_Right = null; } }; // **************** // PAINT RIGHT PB // ***************** pictureBox_Right.Paint += (s, e) => { //pen object at top of form code, set to red and width 5 currently if (ZoomFlagR == false) { // ZoomFactor = 3.0F; // e.Graphics.TranslateTransform(0.0F, 0.0F); if (line_Right != null) { e.Graphics.DrawLine(pen, line_Right.Start.X / ZoomRight_X, line_Right.Start.Y / ZoomRight_Y, line_Right.End.X / ZoomRight_X, line_Right.End.Y / ZoomRight_Y); } foreach (var l in lines_Right) { e.Graphics.DrawLine(pen, l.Start.X / ZoomRight_X, l.Start.Y / ZoomRight_Y, l.End.X / ZoomRight_X, l.End.Y / ZoomRight_Y); } } else { if (line_Right != null) { e.Graphics.DrawLine(pen, line_Right.Start, line_Right.End); } foreach (var l in lines_Right) { e.Graphics.DrawLine(pen, l.Start, l.End); // Debug.WriteLine("lines " + l.Start.X); } } }; } // ************************************************************* // ZOOM LEFT Picture box // ***************************** private void ZoomPBbutton_Click(object sender, EventArgs e) { //if already zoomed - unzoom if (ZoomFlagL == true) //make small { pictureBox_Left.Height = m_pb1_height; pictureBox_Left.Width = m_pb1_width; pictureBox_Left.Location = save_lpbl; pictureBox_Left.SendToBack(); pictureBox_Right.Invalidate(); } else // make large { //pictureBox_Left.SizeMode times 3 pictureBox_Left.Width = 1080; pictureBox_Left.Height = 810; pictureBox_Left.Location = new Point(200, 10); pictureBox_Left.BringToFront(); //puts it on top pictureBox_Right.Invalidate(); } if (ZoomFlagL == true) { ZoomFlagL = false; } else { ZoomFlagL = true; } }
public DyPDFCreator(ImageCore imageCore, List <short> indexList, PDFCreator pdfCreator) { m_ImageCore = imageCore; m_IndexList = indexList; m_PDFCreator = pdfCreator; }
public static string TransToString(this ImageCore img) => JsonSerializer.Serialize(img, new JsonSerializerOptions { WriteIndented = true });
public static bool IsContainColorPalette(this ImageCore img) => img.BitCount < 9;
public static bool IsBmp(this ImageCore img, int headVal) => headVal == 19778;
public CameraTestForm() { InitializeComponent(); camman = new CameraManager("1234"); imagecore = new ImageCore(); }