Click here to Skip to main content
15,885,278 members
Home / Discussions / C#
   

C#

 
AnswerRe: about dynamic form and controls, database fields created by user throw c sharp .net windows application Pin
Richard MacCutchan18-Feb-15 22:04
mveRichard MacCutchan18-Feb-15 22:04 
QuestionWcf Service connection to SQL Database Pin
happyghoos18-Feb-15 12:21
happyghoos18-Feb-15 12:21 
Question[Solved] MySQL dataGridView search function problem Pin
Linus Agren18-Feb-15 9:47
Linus Agren18-Feb-15 9:47 
AnswerRe: MySQL dataGridView search function problem Pin
Ron Nicholson18-Feb-15 10:00
professionalRon Nicholson18-Feb-15 10:00 
GeneralRe: MySQL dataGridView search function problem Pin
Linus Agren19-Feb-15 4:56
Linus Agren19-Feb-15 4:56 
QuestionDataGridView et oracle Pin
youssefcss18-Feb-15 5:32
youssefcss18-Feb-15 5:32 
SuggestionRe: DataGridView et oracle Pin
Richard MacCutchan18-Feb-15 5:41
mveRichard MacCutchan18-Feb-15 5:41 
QuestionFast Image Stitching Pin
JBHowl18-Feb-15 5:03
JBHowl18-Feb-15 5:03 
I'm pulling in images from a camera at around 300 frames a second and i'm stitching them together. I'm not even close to being able to keep up with the camera currently. I was hoping I could get some of the experts here at CodeProject to review my code and point out anyways to make the process faster.

Thanks
C#
 Bitmap currentStitch = null;
       private void StitchImage(object sender)
       {
           for (int i = 0; i < FrameList.Count; i++)
           {
               if (currentStitch == null) currentStitch = (Bitmap)FrameList[i].Clone();
               else
                   AddCurretnSlice(FrameList[i]);
           }
       }

private void AddCurretnSlice(Bitmap Slice)
       {
           Bitmap newStitch = new Bitmap(currentStitch.Width + Slice.Width, Slice.Height);
           BitmapData destinationData = newStitch.LockBits(new Rectangle(0, 0, newStitch.Width, newStitch.Height), ImageLockMode.ReadWrite, currentStitch.PixelFormat);
           BitmapData overlayData = currentStitch.LockBits(new Rectangle(0, 0, currentStitch.Width, currentStitch.Height), ImageLockMode.ReadOnly, currentStitch.PixelFormat);
           BitmapData sourceData = Slice.LockBits(new Rectangle(0, 0, Slice.Width, Slice.Height), ImageLockMode.ReadOnly, Slice.PixelFormat);
           try
           {
               int dstHeight = destinationData.Height;
               int src1Height = overlayData.Height;
               int src2Height = sourceData.Height;

               int src1Stride = overlayData.Stride;
               int src2Stride = sourceData.Stride;
               int dstStride = destinationData.Stride;

               int pixelSize = System.Drawing.Image.GetPixelFormatSize(sourceData.PixelFormat) / 8;
               int copySize1 = overlayData.Width * pixelSize;
               int copySize2 = sourceData.Width * pixelSize;

               // do the job
               unsafe
               {
                   byte* src1 = (byte*)overlayData.Scan0.ToPointer();
                   byte* src2 = (byte*)sourceData.Scan0.ToPointer();
                   byte* dst = (byte*)destinationData.Scan0.ToPointer();

                   // for each line
                   for (int y = 0; y < dstHeight; y++)
                   {
                       if (y < src1Height)
                           AVision.SystemTools.CopyUnmanagedMemory(dst, src1, copySize1);
                       if (y < src2Height)
                           AVision.SystemTools.CopyUnmanagedMemory(dst + copySize1, src2, copySize2);

                       src1 += src1Stride;
                       src2 += src2Stride;
                       dst += dstStride;
                   }
               }

           }
           finally
           {
               newStitch.UnlockBits(destinationData);
               currentStitch.UnlockBits(overlayData);
               Slice.UnlockBits(sourceData);

               currentStitch.Dispose();
               currentStitch = newStitch;
           }
       }

AnswerRe: Fast Image Stitching Pin
Ravi Bhavnani18-Feb-15 5:12
professionalRavi Bhavnani18-Feb-15 5:12 
GeneralRe: Fast Image Stitching Pin
JBHowl18-Feb-15 5:21
JBHowl18-Feb-15 5:21 
GeneralRe: Fast Image Stitching Pin
Eddy Vluggen18-Feb-15 5:45
professionalEddy Vluggen18-Feb-15 5:45 
GeneralRe: Fast Image Stitching Pin
JBHowl18-Feb-15 9:00
JBHowl18-Feb-15 9:00 
GeneralRe: Fast Image Stitching Pin
Eddy Vluggen18-Feb-15 9:26
professionalEddy Vluggen18-Feb-15 9:26 
AnswerRe: Fast Image Stitching Pin
Gerry Schmitz18-Feb-15 16:17
mveGerry Schmitz18-Feb-15 16:17 
GeneralRe: Fast Image Stitching Pin
JBHowl6-May-15 3:21
JBHowl6-May-15 3:21 
GeneralRe: Fast Image Stitching Pin
Gerry Schmitz6-May-15 9:51
mveGerry Schmitz6-May-15 9:51 
AnswerRe: Fast Image Stitching Pin
Pete O'Hanlon23-Feb-15 2:36
mvePete O'Hanlon23-Feb-15 2:36 
Questiongenetic algorithm using C# Pin
Member 1143886118-Feb-15 1:26
Member 1143886118-Feb-15 1:26 
AnswerRe: genetic algorithm using C# Pin
CHill6018-Feb-15 1:40
mveCHill6018-Feb-15 1:40 
QuestionRe: genetic algorithm using C# Pin
ZurdoDev18-Feb-15 1:59
professionalZurdoDev18-Feb-15 1:59 
AnswerRe: genetic algorithm using C# Pin
CHill6018-Feb-15 2:12
mveCHill6018-Feb-15 2:12 
Questionhelp on WebBrowser Controller to select a value on a drop down list Pin
Member 1144865317-Feb-15 18:47
Member 1144865317-Feb-15 18:47 
AnswerRe: help on WebBrowser Controller to select a value on a drop down list Pin
Richard MacCutchan17-Feb-15 22:45
mveRichard MacCutchan17-Feb-15 22:45 
QuestionThreads vs. Tasks Article Pin
Kevin Marois17-Feb-15 18:03
professionalKevin Marois17-Feb-15 18:03 
AnswerRe: Threads vs. Tasks Article Pin
Pete O'Hanlon17-Feb-15 20:22
mvePete O'Hanlon17-Feb-15 20:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.