اظهار صورة ملتقطة من webcam في DATAGRIDVIEW - nasro.betz - 04-03-20
السلام عليكم
استخدم حاليا webcam لالتقاط صور ثم حفظها في الكمبيوتر ولكني لدي داتاقريد أود اظهار الصور الملتقطة فيها بعد الضغط على زر الالتقاط
i used a webcam to capture pictures and save it to my computer now i would like to show every picture tooked in a column in my DATAGRIDVIEW i added a new column to my datagrid, but i did not find a way to show them i want when i click capture button == > save it directly in my computer at the same time show it to my datagridview
كود :
Private Sub frmWeight_Load(sender As Object, e As EventArgs) Handles MyBase.Load
DataGridView1.DataSource = vbEmpty
DataGridView1.Columns.Clear()
Dim table As New DataTable
table.Columns.Add("Picture_name", GetType(String))
table.Columns.Add("Gewicht", GetType(String))
btnWeiter.Enabled = False
HERE I ADDED THE IMAGE COLUMN '
Dim dgvImageColumn As New DataGridViewImageColumn
dgvImageColumn.DataPropertyName = "ActualPaketImage"
dgvImageColumn.Name = "ActualPaketImage"
dgvImageColumn.ImageLayout = DataGridViewImageCellLayout.Zoom
DataGridView1.Columns.Add(dgvImageColumn)
DataGridView1.DataSource = table
With Me.DataGridView1.RowTemplate
.DefaultCellStyle.BackColor = Color.Bisque
.Height = 150
.MinimumHeight = 20
End With
Me.DataGridView1.DataSource = table
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
DataGridViewCellStyle1.Font = New System.Drawing.Font("Microsoft Sans Serif", 20.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.DataGridView1.DefaultCellStyle = DataGridViewCellStyle1
Me.DataGridView1.Columns(0).Width = 120
Me.DataGridView1.Columns(1).Width = 120
Me.DataGridView1.Columns(2).Width = 400
End sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
PictureBox1.Image = Capture.QueryFrame.ToBitmap()
Catch ex As Exception
Capture = New Emgu.CV.Capture
End Try
End Sub
' start the webcam
Private Sub startWebcam_Click(sender As Object, e As EventArgs) Handles startWebcam.Click
Timer1.Start()
End Sub
Private pakNum As Integer = 0
Private Sub captWebcam_Click(sender As Object, e As EventArgs) Handles captWebcam.Click
Timer1.Stop()
'Save the picture
pakNum += 1
PictureBox1.Image.Save("D:\WEBCAM\Img" & strBarcode & "-" & pakNum.ToString("00") & ".JPEG", Imaging.ImageFormat.Jpeg)
capture.Dispose()
startWebcam.Visible = False
Timer1.Start()
End Sub
RE: اظهار صورة ملتقطة من webcam في DATAGRIDVIEW - alsalamoni - 04-03-20
(04-03-20, 01:26 PM)nasro.betz كتب : السلام عليكم
استخدم حاليا webcam لالتقاط صور ثم حفظها في الكمبيوتر ولكني لدي داتاقريد أود اظهار الصور الملتقطة فيها بعد الضغط على زر الالتقاط
i used a webcam to capture pictures and save it to my computer now i would like to show every picture tooked in a column in my DATAGRIDVIEW i added a new column to my datagrid, but i did not find a way to show them i want when i click capture button == > save it directly in my computer at the same time show it to my datagridview
كود :
Private Sub frmWeight_Load(sender As Object, e As EventArgs) Handles MyBase.Load
DataGridView1.DataSource = vbEmpty
DataGridView1.Columns.Clear()
Dim table As New DataTable
table.Columns.Add("Picture_name", GetType(String))
table.Columns.Add("Gewicht", GetType(String))
btnWeiter.Enabled = False
Dim img As New DataGridViewImageColumn()
table.Columns.Add("picture")
img.HeaderText = "picture"
Img.Name = "img"
End sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
PictureBox1.Image = Capture.QueryFrame.ToBitmap()
Catch ex As Exception
Capture = New Emgu.CV.Capture
End Try
End Sub
' start the webcam
Private Sub startWebcam_Click(sender As Object, e As EventArgs) Handles startWebcam.Click
Timer1.Start()
End Sub
Private pakNum As Integer = 0
Private Sub captWebcam_Click(sender As Object, e As EventArgs) Handles captWebcam.Click
Timer1.Stop()
'Save the picture
pakNum += 1
PictureBox1.Image.Save("D:\WEBCAM\Img" & strBarcode & "-" & pakNum.ToString("00") & ".JPEG", Imaging.ImageFormat.Jpeg)
capture.Dispose()
startWebcam.Visible = False
Timer1.Start()
End Sub
كود :
table.Columns.Add("picture",gettype(byte()))
RE: اظهار صورة ملتقطة من webcam في DATAGRIDVIEW - khodor1985 - 04-03-20
RE: اظهار صورة ملتقطة من webcam في DATAGRIDVIEW - nasro.betz - 05-03-20
لم تشتغل معي
|