Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using AForge library now to show video from my webcam on a pictureBox , i am using the following code and i have this weird sign appearing .

This is the image of weird sign

Also i have another problem , after running the application i get my code and design set to read-only mode , so i can't change anything , i don't know why and i don't know how to stop this mode , this is what i am seeing right now :

This is the image of read-only problem

the code is following

public partial class Form1 : Form {

    FilterInfoCollection videoSources;
    VideoCaptureDevice videoStream;

    public Form1(){
        InitializeComponent();
    }

    private void startStream_Click(object sender, EventArgs e){
        videoStream.SignalToStop();
    }

    private void Form1_Load(object sender, EventArgs e){
        videoSources = new FilterInfoCollection(FilterCategory.VideoInputDevice);
        videoStream = new VideoCaptureDevice(videoSources[0].MonikerString);
        videoStream.NewFrame += new NewFrameEventHandler(videoStream_NewFrame);
        videoStream.Start();
    }

    void videoStream_NewFrame(object sender, NewFrameEventArgs eventArgs){
        Bitmap newFrame = eventArgs.Frame;
        pictureBox1.Image = newFrame;
    }


}
Posted
Comments
Sergey Alexandrovich Kryukov 15-Dec-12 2:24am    
This PictureBox control causes way more trouble than use. It provides a very little help: very simplified way of adding static (or almost static) image. It is not really needed for development, as anyone can show the image without it. The problem is: the beginner waste time on it trying to do something dynamic/interactive/animated. This control is absolutely not needed for that. Don't use it. As simple as that.
—SA
Adham Shafik 15-Dec-12 2:34am    
so what is your advice ?
what tool should i use to display my video from webcam then ?
Sergey Alexandrovich Kryukov 15-Dec-12 2:37am    
Based on DirectX. GDI is a bit too slow for video. There are available components...
But if you want to do it with GDI, render frames on a control derived from Control. But do you have compression (time compression, not just spatial)?
—SA
Adham Shafik 15-Dec-12 2:44am    
Oh , you make it too complex for a computer vision researcher just started his C# trial !
Sergey Alexandrovich Kryukov 15-Dec-12 2:53am    
I make? You must be joking. This is the same as to say: "Oh, you say I'll need a hammer to hit on nails. You are making it too complex; I thought I would be able to just push them with my hands".

This way, you make it too complex. The way you start it, you will never find ends. If you want to advance your research, you need to take it a bit more serious. If you want is simple, simply use available player component, forget your research.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900