Reading a binary image.
can anybody shed some light on this for me?
thanks :)
Not unless you expand a bit. Your subject could be about pseudo-mounting an ISO, or processing an unspecified graphics format.
Similar Messages
-
Read 16 bit binary image into LabVIEW, convert to TIFF and display
Hello,
I have what is probably a simple problem - I have RAW images (1536 x 1944) saved in binary files consisting of unsigned 16 bit integers that I need to read into LabVIEW and be able to view on the front panel (so presumably convert to TIFF or something like that).
This is not information that was written using LabVIEW - it was actually written using the fwrite command in C++ if that is any help, and has no header information.
I found this example VI:
http://forums.ni.com/t5/LabVIEW/read-the-raw-image-file/td-p/505871/page/2
The picture of the final VI solution that is posted at that link - it looked promising, but the flatten pixmap function appears to only take in 8 or 24 bit inputs, not 16 bit inputs, and I was unsure it if was possible to configure it for 16. Is it possible to use this same structure to read in my binary files as well? If so, what changes need to be made? Otherwise do I need a different function? I am very new to image processing in LabVIEW.
Thank You.Hello,
The flatten pixmap function does not appear to be able to take in 16 bit inputs and I cannot find a function that flattens a 16 bit pixmap. Is there any way you can convert your binary file into that of 8 or 24 bits?
Also, I don't know if this other forum thread may help or give context to the subject.
http://forums.ni.com/t5/LabVIEW/Can-a-16-bit-image-be-displayed-in-a-picture-control/td-p/33347
Cameron T
Applications Engineer
National Instruments -
Read an avi file using "Read from binary file" vi
My question is how to read an avi file using "Read from binary file" vi .
My objective is to create a series of small avi files by using IMAQ AVI write frame with mpeg-4 codec of 2 second long (so 40 frames in each file with 20 fps ) and then send them one by one so as to create a stream of video. The image are grabbed from USB camera. If I read those frames using IMAQ AVI read frame then compression advantage would be lost so I want to read the whole file itself.
I read the avi file using "Read from binary file" with unsigned 8 bit data format and then sent to remote end and save it and then display it, however it didnt work. I later found that if I read an image file using "Read from binary file" with unsigned 8 bit data format and save it in local computer itself , the format would be changed and it would be unrecognizable. Am I doing wrong by reading the file in unsined 8 bit integer format or should I have used any other data types.
I am using Labview 8.5 and Labview vision development module and vision acquisition module 8.5
Your help would be highly appreciated.
Thank you.
Solved!
Go to Solution.
Attachments:
read avi file in other data format.JPG 26 KBHello,
Check out the (full) help message for "write to binary file"
The "prepend array or string size" input defaults to true, so in your example the data written to the file will have array size information added at the beginning and your output file will be (four bytes) longer than your input file. Wire a False constant to "prepend array or string size" to prevent this happening.
Rod.
Message Edited by Rod on 10-14-2008 02:43 PM -
How to display a binary image in a webpage?
Hi,
I want to display a binary image in a webage. The image has been stored in a DB as binary format. I am using servlet. How could I retrieve it and display it on a webpage? Could you give me some suggestions?
I have read some metrial about JAI, the method 'createImageEncoder( )', which seems very helpful! I am on the right way, right? Thanks for your any comments!
Best Regards,
HaiHere is my idea to display the pic on the webpage:
The pic is stored in DB as binary, after retrieving it, the binary data will be converted to JPEG pic. Then, the pic will be saved to the local machine automaticly. After that, I get the pic's SRC, and use html display it.
My code is as follow (not completed), some errors in it. public static String getPayoffSRC(Services serv, long fileId)
throws FileNotFoundException,
DBException,
DbFileNotFoundException,
IOException {
BufferedImage buffy = new BufferedImage(300, 400,
java.awt.image.BufferedImage.TYPE_INT_RGB);
FileOutputStream out = new FileOutputStream(serv.getFileManager().getFileDb(fileId).getFileName());
JPEGImageEncoder jencoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam enParam = jencoder.getDefaultJPEGEncodeParam(buffy);
enParam.setQuality(1.0F, true);
jencoder.setJPEGEncodeParam(enParam);
jencoder.encode(buffy);
out.close();
return Pic's SRC,
} -
PDF binary image display on smartforms?
Hi guys,
I'm very new to this but i hope i can explain it correctly.
Lets say right now l have some pdf stored in SAP(Service Contract for example) and we're reading them as binary image files right?
Is it possible to retrieve such binary image and display them in an existing smartform?
I hope i'm explaining the right way...this has something to do with DMS ??
Below are some codes to further help in my questions.
ALL FUNCTION 'SCMS_UPLOAD'
EXPORTING
filename = '/usr/sap/XXXX/XXXXXX/test.pdf'
binary = 'X'
frontend = ' '
* MIMETYPE =
IMPORTING
filesize = size
TABLES
data = file_data
* EXCEPTIONS
* ERROR = 1
* OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: BEGIN OF content_bin OCCURS 1,
line TYPE SDOK_SDATX,
END OF content_bin.
DATA: BEGIN OF content_txt OCCURS 1,
line TYPE sdokcntasc,
END OF content_txt.
CALL FUNCTION 'SCMS_DOC_READ'
EXPORTING
mandt = sy-mandt
stor_cat = ' '
crep_id = crep_id
doc_id = doc_id
TABLES
* ACCESS_INFO =
content_txt = content_txt
content_bin = content_bin
* EXCEPTIONS
* BAD_STORAGE_TYPE = 1
* BAD_REQUEST = 2
* UNAUTHORIZED = 3
* COMP_NOT_FOUND = 4
* NOT_FOUND = 5
* FORBIDDEN = 6
* CONFLICT = 7
* INTERNAL_SERVER_ERROR = 8
* ERROR_HTTP = 9
* ERROR_SIGNATURE = 10
* ERROR_CONFIG = 11
* ERROR_FORMAT = 12
* ERROR_PARAMETER = 13
* ERROR = 14
* OTHERS = 15
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Anyone? Please its kinda urgent.
Basically, If I understand correctly, what I have now is are converted binary data from the PDF document?
Is there a way to take these data and displaying it meaningfully(may be through some other processes like conversion again) in a smartform? Is this possible? -
I want to convert a image to a binary image(only black& white)
I use this code to convert a color image to a grayscale image:
public static BufferedImage applyGrayscaleFilter(BufferedImage aImage)
BufferedImage tmpBufImage = aImage;
try
for (int i = 0; i < aImage.getWidth(); i++) {
for (int j = 0; j < aImage.getHeight(); j++) {
Color c = new Color(aImage.getRGB(i, j));
int r = c.getRed();
int g = c.getGreen();
int b = c.getBlue();
//formula for grayscale
int gray = (int) (0.2989 * r + 0.5870 * g + 0.1140 * b);
c = new Color(gray, gray, gray);
tmpBufImage.setRGB(i, j, c.getRGB());
catch(Exception ex)
return null;
return tmpBufImage;
I need help for convertin this image(grayscale) to binary image (b&w - only 1 and 0).No need to do it yourself, BufferedImage will do it for you:
Image oldImage= ...;
BufferedImage newImage=new BufferedImage(oldImage.getWidth(null),
oldImage.getHeight(null), BufferedImage.TYPE_BYTE_BINARY);
newImage.getGraphics().drawImage(image, 0, 0, null); -
I want to read the raw image file , i have the basic labview 8.0 version
That is a broad question... I'll make some asumptions.
I think you have a file with some raw image format. This can be quite a few formats. Every camera firm has it's own proprietry format. Often, when talking about a raw image, it is simply a 2d array of colors. So you'll have a file with numbers that are U8's that represent R G B, alpha R G B, B G R, etc., or a U32 that represent the same, combined in one U32...
The data can be stored binary or ASCII. Both formats are handled differently.
The ASCII format can be one large array of data, or seperated with enters for each scan line.
In both cases, you might need to remove information, like height and width, from the data before parsing the image data.
You can use the "Spreadsheet String To Array" to convert the a ASCII string to a LabVIEW 1D or 2D array. Or use "Read From Spreadsheet File.vi" to read the file directly as an array. Use Reshape Array to convert a 1D array to a 2D array.
The binary file is a bit different. Use "Read Binary File". It will get you a string. This string is a converted array of U8, the string doesn't need to be ASCII. convert this string to an array of U8's, with "String To Byte Array". Convert the 1D array just like before.
Now you have a 2D array. You can convert it into a pixmap with "Flatten Pixmap.vi". You can then display it in a picture control with "Draw Flattened Pixmap.vi".
Regards,
Wiebe. -
MVC Display Binary Image from ViewBag
I am having problem when displaying the binary image in MVC view. I stored images in database as binary format and then assigned to ViewBag in Controller. How do I assign viewbag data to image in View?
Controller
ItemBO mibo = new ItemBO();
ViewBag.Picture1 = Convert.ToByte(mibo.GetImage(1));
View
var elem = document.createElement("img");
elem.setAttribute("src", @ViewBag.Picture1);
elem.setAttribute("style", "height:100%");
elem.setAttribute("alt", "Image");
document.getElementById("mydiv").appendChild(elem);
Above code doesn't work as I expected. Any help would be appreciated.MVC section is at the below link.
http://forums.asp.net/ -
Calculate the perimeter of object in binary image how!!!!!!!
Hi
I try to use labview to find area and perimeter of object in binary using vision function
for the area the labview find it in pixel]
but for perimeter I have problem I read from ni.com vision manual this words
http://zone.ni.com/reference/en-XX/help/372916M-01/nivisionconcepts/particle_measurements/
"""Length of a boundary of a region. Because the boundary of a binary image is comprised of discrete pixels, NI Vision subsamples the boundary points to approximate a smoother, more accurate perimeter. Boundary points are the pixel corners that form the boundary of the particle. Refer to the introduction for an illustration of pixel corners."""
what is the problem I really did not understand what he mean::"""Because the boundary of a binary image is comprised of discrete pixels""
can any one explain to us the case please and who will lv find the perimeter
best regards
hi ?Q>Hornless.Rhino wrote:
mangood wrote:
what is the problem I really did not understand what he mean::"""Because the boundary of a binary image is comprised of discrete pixels""
can any one explain to us the case please and who will lv find the perimeter
best regards
Take the following image on the left. You can see it is quite jagged.
Since pixels are square/rectangular you cannot have a perfectly straight edge on a line that is not horizontal or vertical.
But looking at how the edge of the object actually is, the jaggedness can be "smoothed out" and hence help determine what the perimiter should be were it perfectly smooth.
thank you
do you mean that lv do a low pass filter for image before he caculate the perimeter?????
finally which connectivity is best 4 or 8 for finding the perimeter??? or which algorthem used by lv to find the perimeter???
best regards
hi ?Q> -
I am a neuroscientist developing a brain atlas and am using illustrator to produce the images needed.
Basically I need to open up an .ai file that contains the brain image. I need to fill that with black, remove parts of it
(haven't figured out how to do that yet) and export it at a specific location within the canvas and make the canvas a specific size.
I need to export that as a .jpeg or .gif with only 2 colors. I then need to repeat this process 700 times.
Is there a way to remove a part of an image quickly?
Is there any way to export with only 2 colors? (binary image)
Any ideas would be greatly appriciated.1- The images are in vector format
2- I am using version 14 but will be using version 15 when my lab gets it.
3- I don't have photoshop, though I have used it and fireworks a long time ago
4-
http://books.google.ca/books?id=0prYfdDbh58C&printsec=frontcover&dq=paxinos+watson&source= bl&ots=-5jsGV_LAk&sig=fV18n7RLuPTgv9Y7rpHJ93cyi2I&hl=en&ei=ttcGTIrvCoW0lQeh0Yi-Cg&sa=X&oi= book_result&ct=result&resnum=4&ved=0CCkQ6AEwAw#v=onepage&q&f=false
or try brainmaps.org
A brain atlas is an atlas of the brain. In my case a rat brain. Not much different than an atlas you would be familiar with. It contains images and coordinates showing where areas and structures are. Since the brain is 3D a brain atlas is also in 3D. It is usually organized by having slices (think loaf of bread) placed one after another on separate pages of a book. We get the pictures in the atlas by staining the brain with chemicals that make it change colors. Then we cut it into sections on a braincutting machine and put it on a microscope slide to take a picture.
In our lab we use electrodes to listen in on what brain cells are doing. This brain atlas will allow us to show where our electrode tips were in the brain and what areas we were targeting. It is mainly for presentations and teaching.
I will be using illustrator to produce binary images of the essential stuff in exactly the right places. Once I have those I have some computer code that will stack those images together to make a 3D brain.
My biggest problem is exporting with only 2 colors in the entire image. I should be able to use my programming knowledge to take care of everything else.
I have never used any graphic vector software before so any help I can get is greatly appreciated. -
PC Users cannot read the JPG images attached to my emails
Several users of PC's, running Vista or Win 7, have difficulties to read the JPG images attached to my emails. All they see is an endless list of numbers and signs (in fact the binary data of the image).
The problem can only be solved by zipping the images.
is this due to a setup option in MAIL, or do you know how to solve this issue?
PatrickIf I had to guess, I would bet that your images do not have a ".jpg" or ".jpeg" extension on the end. This is how PCs identify the file - and Macs, too, these days, unfortunately. You also should make sure that Edit -> Attachments -> Always Send Windows-Friendly Attachments is checked.
-
Extract foreground from binary image
hi
i need help in java programming in java.
i have a binary image
by the code
BufferedImage image = ImageIO.read(new File("f:/123.JPG"));
BufferedImage bwImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
//bwImage.createGraphics().drawImage(image, 0, 0, null);
BufferedImage bwImage1 = new BufferedImage(bwImage.getWidth(), bwImage.getHeight(), BufferedImage.TYPE_BYTE_BINARY);
//bwImage1.createGraphics().drawImage(image, 0, 0, null);
i need only foreground in color..can u give me the code for that..its urgent..If you want any color whatsoever, then you need to use a BufferedImage type that supports color. BufferedImage.TYPE_BYTE_BINARY wont do. In the example below I use BufferedImage.TYPE_INT_RGB. The foreground remains in color, while everthing else turns white.
BufferedImage image = ImageIO.read(...);
BufferedImage fgImage = //foreground image
new BufferedImage(image.getWidth(),image.getHeight(),
BufferedImage.TYPE_INT_RGB);
for(int x = 0; x < fgImage.getWidth(); x++) {
for(int y = 0; y < fgImage.getHeight(); y++) {
int rgbSrc = image.getRGB(x, y);
if(rgbSrc == rgbForeground) {
fgImage.setRGB(x,y,rgbForeground); //remain in color
}else{
fgImage.setRGB(x,y,-1); //set white
}Or are you looking for more of a Sin City effect where one thing remains in color and everything else is in grayscale?
BufferedImage image = ImageIO.read(...);
BufferedImage fgImage = //foreground image
new BufferedImage(image.getWidth(),image.getHeight(),
BufferedImage.TYPE_INT_RGB);
for(int x = 0; x < fgImage.getWidth(); x++) {
for(int y = 0; y < fgImage.getHeight(); y++) {
int rgbSrc = image.getRGB(x, y);
if(rgbSrc == rgbForeground) {
fgImage.setRGB(x,y,rgbForeground); //remain in color
}else{
int r = (rgbSrc>>16)&0xff;
int g = (rgbSrc>> 8)&0xff;
int b = (rgbSrc )&0xff;
int lum = (int) (.299 * r + .587 * g + .144 * b);
//set to grayscale
fgImage.setRGB(x,y,(255<<24)|(lum<<16)|(lum<<8)|lum);
} -
Retain color to foreground in binary image
hi
i need some help in the java.
I have binary image whose foreground is white nad background is black by the following code
BufferedImage image = ImageIO.read(new File("f:/123.JPG"));
BufferedImage bwImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
BufferedImage fgImage = //foreground image
new BufferedImage(bwImage.getWidth(),bwImage.getHeight(),
BufferedImage.TYPE_BINARY_IMAGE);
now i want to retain color to the foreground only..
can anyone help me..pleaseeeeeeeHere is my idea to display the pic on the webpage:
The pic is stored in DB as binary, after retrieving it, the binary data will be converted to JPEG pic. Then, the pic will be saved to the local machine automaticly. After that, I get the pic's SRC, and use html display it.
My code is as follow (not completed), some errors in it. public static String getPayoffSRC(Services serv, long fileId)
throws FileNotFoundException,
DBException,
DbFileNotFoundException,
IOException {
BufferedImage buffy = new BufferedImage(300, 400,
java.awt.image.BufferedImage.TYPE_INT_RGB);
FileOutputStream out = new FileOutputStream(serv.getFileManager().getFileDb(fileId).getFileName());
JPEGImageEncoder jencoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam enParam = jencoder.getDefaultJPEGEncodeParam(buffy);
enParam.setQuality(1.0F, true);
jencoder.setJPEGEncodeParam(enParam);
jencoder.encode(buffy);
out.close();
return Pic's SRC,
} -
Multiplied by the binary image
Hi every body
I want multiply a binary image to another image. another image is a withe image with 255 value across it.
please help me how can I?Hi Tandis,
I don't see the sense in multiplying with a constant value, but well:
convert your image to a 2D array, then use the standard multiply function… -
Hi, I've been trying to use the IMAQ Extract Contour VI to get a contour of a seeded jet (is a binary image). t is sent to the IMAQ Extract Contour VI, but this last one fails to find the contour. I don't know if the algorithm is able for this kind of problem.
Could someone help me please? The Vi and the image are attached below.
Attachments:
3.png 554 KB
extract contour.vi 46 KBHi Giansorr,
thank you for your post on NI forum. In order to perform a Contour Analysis, you can try to analyze some examples you can find at the following path:
<LabVIEW>\examples\Vision\2. Functions\Contour Analysis
The contour algorithm works fine if the image you are going to analyze has wel defined contours.
You can try to run the above examples with your .png image.
Have a nice work.
Claudio Cupini
NI ITALY
Applications Engineering Dept.
Maybe you are looking for
-
Text caption height in responsive project is not automatically resizing
Hi all, I have a Captivate 8 responsive project in which a text caption is not behaving properly. When I get down to smartphone-sized screens the width of the text caption reduces with the width of the device. But, the height of the text caption does
-
IDoc adapters not in "communication channel monitoring"?
Hi, I've modified some information that the receiver IDoc adapter is using (the logical system ID). But after I refreshed all the caches the change is not updated when I send an IDoc to R/3. When this kind of problem happens with RFC adapter you just
-
How to export PDF with Bookmarks from Headings?
Does anyone know if it's possible to export a PDF with Bookmarks (not internet bookmarks, but rather the Table of Contents in Preview.app bookmarks) from the style headings? Word 2007 does it with the Save to PDF add-on. Here is what i mean: http://i
-
Is it necessary to have photo stream "on" in ICloud?
Is it necessary to have "photo stream" turned ON in ICloud?
-
In Edge Animate, how do I fade an image in on mouseover?
In Edge Animate, how do I fade an image in on mouseover? Thanks!