Quantcast

How to display 12 bit images in UIImageView

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to display 12 bit images in UIImageView

pritish
Hi to All,

  From few days I am struggling to display 12 bit images in UIImageView images are displayed but "Not Properly" I show you image screenshot how it render on UIImageView

this is the out put i get from my code as below

const int bytesPerPixel = 4;
int _width = (int)_drawArg.RectUIImageMatrix.Width;
int _height = (int)_drawArg.RectUIImageMatrix.Height;
CGImage _bitmap ;

Rectangle srcRectangle = new Rectangle(0, 0, imageGraphic.Columns, imageGraphic.Rows);
Rectangle rect = Rectangle.Round(new RectangleF(0,0,_width , _height));
Rectangle dstRectangle = rect;

int[] srcPixels = new int[image.Columns * image.Rows * image.PixelData.BytesPerPixel];

int bitsPerComponent = 8;
int bytesPerRow = srcRectangle.Width * bytesPerPixel  *2;
var  pixelBytes = imageGraphic.PixelData.Raw;
CGColorSpace _color = CGColorSpace.CreateDeviceRGB();
CGDataProvider _provide = new CGDataProvider(pixelBytes , 0,pixelBytes.Length);

_bitmap = new CGImage(srcRectangle.Width,srcRectangle.Height ,bitsPerComponent,32,bytesPerRow , _color , CGBitmapFlags.ByteOrder16Big | CGBitmapFlags.PremultipliedLast ,_provide ,null ,true ,CGColorRenderingIntent.Default);


ImgView.Image = UIImage.FromImage(_bitmap);


So please help me !!!!!!!!! Its Very Urgent for Me

Regards
Pritish M. Deshmukh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display 12 bit images in UIImageView

Nic Wise
What should it look like? I assume the purple bit should be black and white?

could it be this?

> _bitmap = new CGImage(srcRectangle.Width,srcRectangle.Height
> ,bitsPerComponent,32,bytesPerRow , _color , CGBitmapFlags.ByteOrder16Big |
> CGBitmapFlags.PremultipliedLast ,_provide ,null ,true
> ,CGColorRenderingIntent.Default);

Change the ByteOrder16Big to ByteOrder16Small (or Little?). I'm guessing, BTW...



On Wed, Aug 8, 2012 at 12:01 PM, pritish
<[hidden email]> wrote:

> Hi to All,
>
>   From few days I am struggling to display 12 bit images in UIImageView
> images are displayed but "Not Properly" I show you image screenshot how it
> render on UIImageView
> http://monotouch.2284126.n4.nabble.com/file/n4656427/brain.jpg
> http://monotouch.2284126.n4.nabble.com/file/n4656427/chest.png
>
> this is the out put i get from my code as below
>
> const int bytesPerPixel = 4;
> int _width = (int)_drawArg.RectUIImageMatrix.Width;
> int _height = (int)_drawArg.RectUIImageMatrix.Height;
> CGImage _bitmap ;
>
> Rectangle srcRectangle = new Rectangle(0, 0, imageGraphic.Columns,
> imageGraphic.Rows);
> Rectangle rect = Rectangle.Round(new RectangleF(0,0,_width , _height));
> Rectangle dstRectangle = rect;
>
> int[] srcPixels = new int[image.Columns * image.Rows *
> image.PixelData.BytesPerPixel];
>
> int bitsPerComponent = 8;
> int bytesPerRow = srcRectangle.Width * bytesPerPixel  *2;
> var  pixelBytes = imageGraphic.PixelData.Raw;
> CGColorSpace _color = CGColorSpace.CreateDeviceRGB();
> CGDataProvider _provide = new CGDataProvider(pixelBytes ,
> 0,pixelBytes.Length);
>
> _bitmap = new CGImage(srcRectangle.Width,srcRectangle.Height
> ,bitsPerComponent,32,bytesPerRow , _color , CGBitmapFlags.ByteOrder16Big |
> CGBitmapFlags.PremultipliedLast ,_provide ,null ,true
> ,CGColorRenderingIntent.Default);
>
>
> ImgView.Image = UIImage.FromImage(_bitmap);
>
>
> So please help me !!!!!!!!! Its Very Urgent for Me
>
> Regards
> Pritish M. Deshmukh
>
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/How-to-display-12-bit-images-in-UIImageView-tp4656427.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display 12 bit images in UIImageView

pritish
Ya Its an B&W Image
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display 12 bit images in UIImageView

pritish
In reply to this post by Nic Wise
Sorry Nic Your solution I tried but it is not working it gives me O/P
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display 12 bit images in UIImageView

Nic Wise
I'm guessing, but I think it might be that you are copying 2 rows of
data each time, so

int bitsPerComponent = 8;
int bytesPerRow = srcRectangle.Width * bytesPerPixel  *2;

should not have the *2 on the end. From the images, it looks like you
are copying the first 2 lines, and making them into _1_ line in the
output.

What happens if you debug it? If the input is 12 bit, is that 12 bits
per color part (R/G/B?) or 12 bits total - 4 bits per color part?



On Wed, Aug 8, 2012 at 4:49 PM, pritish
<[hidden email]> wrote:

> Sorry Nic Your solution I tried but it is not working it gives me O/P
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/How-to-display-12-bit-images-in-UIImageView-tp4656427p4656435.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Loading...