Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. 1500 x 1500 fast image diplaying

1500 x 1500 fast image diplaying

Scheduled Pinned Locked Moved WCF and WF
csharpwpfcomquestion
1 Posts 1 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andreoli Carlo
    wrote on last edited by
    #1

    Hello, i'm moving my actual winform based application to WPF. My application acquire 1500x1500 8bit depth images at 30 frame per second. In winform i was used to BitBlt my images to a panel handle and that work fine. In wpf i tried two ways:

    // on every frame:
    int stride = img_w * ((PixelFormats.Gray8.BitsPerPixel + 7) / 8);
    bmpSource = BitmapSource.Create(img_w, img_h, 96, 96, PixelFormats.Gray8, null, my_arrb_8bit, stride);

    this.Image1.Source = bmpSource;

    but this is too slow...then i try

    // on every frame:
    int max = PixelFormats.Rgb24.BitsPerPixel;
    uint count = (uint)(img_w * img_h * PixelFormats.Rgb24.BitsPerPixel / 8);
    IntPtr section = CreateFileMapping(new IntPtr(-1), IntPtr.Zero, FileMapProtection.PageReadWrite, 0, count, null);
    IntPtr map = MapViewOfFile(section, FileMapAccess.FileMapAllAccess, 0, 0, (UIntPtr)count);

    System.Runtime.InteropServices.Marshal.Copy(my_arrb_24bit, 0, map, (int)count);
    my_ibs = System.Windows.Interop.Imaging.CreateBitmapSourceFromMemorySection(
    section,
    (int)img_w,
    (int)img_h,
    PixelFormats.Rgb24,
    (int)(img_w * PixelFormats.Rgb24.BitsPerPixel / 8), 0) as System.Windows.Interop.InteropBitmap;
    this.Image1.Source = my_ibs;

    this is faster than the first solution, but still i can't manage to reach 30fps....am i doing something wrong? any suggestion?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups