Image processing from .txt file onto an intensity graph
I am doing a mini project in my class and I was wondering if anyone could help me. It about image processing but I am bit stuck.
Heres the idea:
"An image is really nothing more than a 2D array of data. The value of every element in the array corresponds to the brightness of the image at that point.
In this project you will create a VI which loads a 2D array of data and then displays it on the screen using the Intensity Graph. Three example files (boats.txt, gordon.txt and parrot.txt) are available on the module webpage that you can use. However, you can also use any other black and white image you like, but will need to convert it to a “text image” first. To do this you can use some software called “ImageJ” which is available on the computers and is free to download.
You can vary the brightness of an image by adding the same value to every element in the array.
The contrast of an image is adjusted by multiplying every element in the array by the same value. Using numerical controls and simple array mathematics, you should adjust the brightness and contrast of your displayed image.
Some other ideas that you could try with image manipulation are:
o Invert an image (change black to white and white to black)"
First I am having problems putting my picture onto the graph. It is in the write file but the colours are not correct and the image has rotated 90 degrees. I will upload my VI so far when I get back onto my computer.
Would really appricate the help! Thank you for reading
Hi charlthedancer,
Here is an example to get you started.
Kind regards,
GajanS
Attachments:
Test.vi 14 KB
Similar Messages
-
Loading an image in from a file
Hi,
I am trying to load an image in from a file, I have found an example using the following code:
import java.awt.Image;
import java.awt.Toolkit;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
public final class MainClass {
private MainClass() {
public static Image getImage(Class relativeClass, String filename) {
Image returnValue = null;
InputStream is = relativeClass.getResourceAsStream(filename);
if (is != null) {
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
int ch;
while ((ch = bis.read()) != -1) {
baos.write(ch);
returnValue = Toolkit.getDefaultToolkit().createImage(
baos.toByteArray());
} catch (IOException exception) {
System.err.println("Error loading: " + filename);
return returnValue;
}Is this a good way of doing it? I want to load a series of images in from files, so I can later do a comparison against them. I am just wondering how to go about the whole process?
Many thanks, RonCan you store multiple images in memory and be able
to reference them all individually, or is it better
to store them in a construct, such as an array and
then loop through that when attempting to match?I'm sorry but I don't understand the question. And does it
have anything to do with images per se? Can it be generalized
without losing its meaning:
Can you store multiple objects in memory and be able
to reference them all individually, or is it better
to store them in a construct, such as an array and
then loop through that when attempting to match?It seems to me that multiple objects should be stored in
an appropriate collection, if that is what is required.
Perhaps you need to say more about what you are trying to
do, what your goal is, to make your question meaningful. -
How to extract text and image information from postscript file
I want to write a programe,and extract text and image information from postscript file using Java.Is it possible? How to extract ?
Thank!First of all, PostScript is not a "text" file. It can and often does contain binary data. Since PostScript streams often contain nested procedures, unless you process the procedure definitions and can "execute" them, you cannot simply "scan" a file to get what you want. No, I can't talk about this in detail since it is quite complex. But Adobe does have the
PostScript Language Reference Manual on-line for download at
. Look that over and you will have a fairly healthy respect as to the task involved.
- Dov -
Apostroph and euro sign not read corectly from txt file
apostroph and euro sign not read corectly from txt file.
my code is like this:
FileInputStream fis= new FileInputStream(x+".html");
BufferedReader br=new BufferedReader(new InputStreamReader(fis,"UTF-8"));
String Line="";
while ((Line = br.readLine()) != null) result+=Line;
br.close();
fis.close();
I use UTF-8 because the file contains also French characters.
What's the problem?
THANK YOU!apostroph and euro sign not read corectly from txt
file.
my code is like this:
FileInputStream fis= new FileInputStream(x+".html");
BufferedReader br=new BufferedReader(new
InputStreamReader(fis,"UTF-8"));
String Line="";
while ((Line = br.readLine()) != null) result+=Line;
br.close();
fis.close();
I use UTF-8 because the file contains also French
characters.
What's the problem?
THANK YOU!
This is from the FileInputStream API documentation:
FileInputStream is meant for reading streams of raw bytes such as image data. For reading streams of characters, consider using FileReader. -
Batch image processing from bridge cause photoshop to crash
But first it goes ahead and processes the images selected in Bridge. All of them like even over a hundred at a time (great time saver!). Then displays a message for each image in one error dialogue saying, "Sorry Photoshop couldn't process the image. . ." for each image.
It also saves the images to the a folder above (in hierarchy) instead of the folder I select in the batch dialogue. I've tried using Batch process from within Photoshop and get the same result as image process from Bridge.
While I am able to do the processing I need, it's annoying to have the force quit Photoshop each time, and Then to move the processed images where they belong.
I am on a G5, 4mb ram, OSX 10.4.11. Photoshop CS3 #10.0.1, and bridge CS3 # 2.1.1.9.
I usually do the updates when I'm alerted, but haven't heard of anything recently.
Any ideas?Hi SSPrengel
OK - maybe this will shed some light
Try changing the size to something very small.- see below
Try changing the compression. Not affected by the level of Quality (2% 50% or 100%) - all fail to load
Try changing whether a color-profile is embedded or not. Not an option AFAIK in LR Export
Try changing if the metadata is minimized or not. Not an option AFAIK in LR Export
Try changing if the JPGs are exported relative to the source image or some fixed location. Exported to a specific location.
If I use the Image export resize option it loads OK (resize to 1000*673 from 3916*2634).
Older exports (from LR2.3 and earlier, of the same size image, and source DNG are OK)
A centre crop from the Image (1205*691) is OK. A marginal crop (2 edges) (3838*2552) is OK whereas a very slight crop at (3693*2614) FAILS
The camera is Leica M8, images is in Leica RAW format (DNG).
It appears to be function of Image export size (reduced either by Cropping or by 'Resizing on Export'
Looks like a bug in LR2.6
Message was edited by: V64
PS I am using a G5 PowerMac with Tiger OSX -
How to read data from txt file respectively
Hi,
I am triying to form an equation between two known points. I want to do this with the attached VI, the most critical point is that I will read the x1, y1, x2 and y2 coordinates from the same .txt file. They will be written in a .txt file and I will send them to the appropriate channel (x1, y1, x2 and y2) respectively. How can I get data in a rule from a .txt file?
Could anyone please help me with this issue,
Best regards.
Attachments:
read from txt file.vi 8 KBDear RavensFan,
Thank you very much for your helps, I am bit new to labview so I usually can not find the appropriate functions easily. And a new problem has rised in my application. I should write the A, B and C numbers in the respective series to the file 2.txt. I am able to write them in a straight forward case but I want to write the next triples (A B C) in the next row. Like this;
A1 B1 C1
A2 B2 C2
A3 B3 C3
So how can I put new line constant and space constant to my VI?
Waiting for your valuable helps,
Best regards,
Attachments:
read_from_txt_fileMOD.vi 18 KB -
Hello guys,
I need some help. I have to remove some content of Tolerance "column" (see attach). The string which I wish to remove is "+/- 0s" and replace it with an empty string. I need to remove this for each row where "+/- 0s" appears.
Thanks
Solved!
Go to Solution.
Attachments:
sample.txt 3 KBHi Samoth,
I dont know if I understood your requirement properly, but please check the attached snippet if it helps.
If this does not satisfy your requirement, then please give some more details.
Attachments:
Remove string from txt file.png 21 KB -
How to get Text from (.txt) file to display in the JTextArea ?
How to get Text from (.txt) file to display in the JTextArea ?
is there any code please tell me i am begginer and trying to get data from a text file to display in the JTextArea /... please help...public static void readText() {
try {
File testFile = new File(WorkingDirectory + "ctrlFile.txt");
if (testFile.exists()){
BufferedReader br = new BufferedReader(new FileReader("ctrlFile.txt"));
String s = br.readLine();
while (s != null) {
System.out.println(s);
s = br.readLine();
br.close();
catch (IOException ex){ex.printStackTrace();}
}rykk -
HOW DO I PUT A SONG FROM A FILE ONTO MY ITUNES LIBRARY?
how do i put a song from a file onto my itunes library? i had downloaded a song off a website at hal lenards website. and now its on my computer in a file but i don't kno how to get the song onto my library on itunes.
File -> Add to library.
-
How to get string (specified by line and column) from txt file with labview
Hi everyone
How to get string (specified by line and column) from txt file with labview
thx
Solved!
Go to Solution.As far as I know, a text file has no columns. Please be more specific. Do you mean something like the 5th word on line 4, where words are separated by a space, and lines are separated by a newline character? You could the Read from Spreadsheet String function and set the delimiter to a space. This will produce a 2D array of strings. Then use index array and give the line number and column number.
- tbob
Inventor of the WORM Global -
Text layers from .txt file for buisness cards
I have a template for a business card that I created for a company. So imagine I have a background layer which is the card itself, and above that a layer for each string of text on the card (name, title, phone, email). Up until now, I would manually enter all the information using the Type tool to edit each text layer. However, it has become very tedious and I know there has to be a much easier way to do this. I'm looking for a way to automate this process. So far I have created an Excel database of all the employees, and I export each employees information to a .txt file that looks like this:
John Doe
Job Title
123-456-7890
123-456-7890
[email protected]
Each line in the .txt file corresponds to a text layer on the .psd. I've tried following a tutorial from the web (kirupa.com - Photoshop Scripting) but he is creating them in batches which is not what I need to do. And quite frankly, it's a bit over my head. I know scripting must be the way, but unfortunately I don't know much about JaveScript or any other language for that matter.
I know it's a lot to ask for, but if anyone could show me how to write a simple script for this or point me in the right direction, it would be much appreciated. And I mean MUCH!Hey man, that was spot on! This does exactly what I was looking for, now scripting required. Thanks for the help, I really appreciate it.
-
Read at each new line from .txt file
Hi guys
I want to read from a file which I am saving using labview. What I am doing is reading 128 bytes fro VISA port and saving it in .txt file with new line constant. At some later time I want to read 128 bytes from that text file do some processing and display it. The "read from text file" vi has convert EOL but I am not able to configure it. Please help me..
Thanks in advance
NiladriHi Newbee_3,
Do 1 thing, Read the txt file & convert this into string, Then you have all the flexibility to do whatever you want.
Thanks
Kudos are always welcome if you got solution to some extent.
I need my difficulties because they are necessary to enjoy my success.
--Ranjeet -
Image Processing- comparing JPeg files
Hi All,
sorry for posting this question at this forum, but I could not find a separate forum for Image Processing. (although i could search for such forums, but i believe they are taken off.)
I want to compare one input jpeg file with 10 existing files and find the closest match.
can someone give me pointers to start with. i believe there are tools to achieve this.
thanx n regardsNot sure about the way you are using, but look at these links.
Resizing Photos for Emailing
http://www.apple.com/pro/tips/emailresize.html
Resize!
http://kstudio.net/
PhotoToolCM
http://www.pixture.com/software/macosx.php
SmallImage
http://www.iconus.ch/fabien/smallimage2/
ImageTool
http://www.macupdate.com/info.php/id/23281
ImageWell
http://www.xtralean.com/IWOverview.html
Resize JPEG Files
http://www.macworld.com/weblogs/macgems/2006/09/jpegresize/index.php
Cheers, Tom -
Auto delete everything but specified folder contents from txt file
Hey Guys,
I am brand new to using Powershell (like 48 hours into using it for work) and I've run into a bit of an issue. I've only taken a programming concept classes so some of the stuff makes sense to me but a lot of it is new. Basically I've made a
script that automatically deletes any files over X amount of days. My next step is to have an exceptions text that will have a list of folders that should not have its contents deleted. This is what I have so far.
$Date= Get-Date
$Days = "7"
$Folder = "C:\publicftp\users"
$LastWrite = $Now.AddDays(-$Days)
#----- getting DO NOT DELETE listing from TXT ----#
$Exceptions = Get-Content "c:\exclude.txt"
$Files = Get-Childitem $Folder -Recurse -Exclude "c:\exclude.txt" | Where {$_.LastWriteTime -le "$LastWrite"}
foreach ($File in $Files)
if ($File -ne $NULL)
Remove-Item $File.FullName -Exclude $Exceptions | out-null
I've seen a lot of threads that show how to auto delete contents or how to exclude specific file types but I haven't seen an answer to my particular problem. Any help would be greatly appreciated! Thanks!Hi Rabbot,
The script below may be also helpful for you, and uses the -whatif parameter in Remove-Item cmdlet, which doesn’t actually remove anything but simply tells you what would happen if you did call Remove-Item.
$Exceptions = @()
Get-Content "c:\exclude.txt" | foreach{
$Exceptions += $_} #store the exception file to array
$Folder = "C:\publicftp\users"
$LastWrite = (get-date).adddays(-7) #over 7 days.
$Files = Get-Childitem $Folder -Recurse | Where {$_.LastWriteTime -le $LastWrite} #filter files which over 7 days.
Foreach ($file in $files){
if ($Exceptions -notcontains $file.fullname){ #if the file is not listed in the exception array.
Remove-Item $File.FullName -whatif} #use -whatif to test
I hope this helps. -
Scenario to read from txt-file and create a sales order
Hi,
i have started creating a scenario to read from an txt-file and to create a sales order.
When i activate my scenario, i get the following message :
no scenario step (vBIU) associated for this step for the incoming system (SysId)
When i look into the detailed xml-file i see that all the records are read from the file, but there is no next step to be treated.
Has somebody any idea how this come ?
-<Msg MessageLog="true" msglogexcl="false" logmsg="0009" recording="true" BeginTimeStamp="20111202095144" MessageId="11120209514499820828C0A801674F24" xmlns="urn:com.sap.b1i.vplatform:entity">-<Header><msglog b1ifactive="true" always="false" step="Default message log"/>-<Resumption><starter ipo="/vP.0010000138.in_FEAN/com.sap.b1i.vplatform.runtime/INB_FI_EXST_ASYN_NAM/INB_FI_EXST_ASYN_NAM.ipo/proc"/></Resumption><IPO tid="11120205535899820808C0A801678C54" Id="INB_FI_EXST_ASYN_NAM"/><Sender Id="0010000138"/><Inbound file="ORDERS_TEST" ext="csv" path="C:\TEMP\In" pltype="txt" wrap="" deli=";"/></Header>-<Body><Payload Type="File exist" Role="T"/>-<Payload Role="S">-<io xmlns="urn:com.sap.b1i.bizprocessor:bizatoms" pltype="txt">
-<row>
<col>OH</col>
<col>0000087077</col>
<col>201110041205</col>
<col>220</col>
<col>9</col>
<col>201110191702</col>
<col>8710624300012</col>
<col>8714252008609</col>
<col>8710624300012</col>
<col>8714252008609</col>
<col>8710624300012</col>
<col>N</col>
<col>N</col>
<col>N</col>
</row>
-<row>
<col>OL</col>
<col>1</col>
<col>8711715844378</col>
<col>20</col>
</row>-<row>
<col>OL</col>
<col>2</col>
<col>8711715844392</col>
<col>60</col>
</rowrow>
<col>OL</col>
<col>16</col>
<col>8710251791092</col>
<col>280</col>
</row>
</io>
</Payload>
</Body>
</Msg>
This is my final atom :
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:b1e="urn:com.sap.b1i.sim:b1event" xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:utils2="com.sap.b1i.bpc_tools.Utilities" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" xmlns:xci="urn:com.sap.b1i.xcellerator:intdoc" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" bfa:force="" vpf:force="" jdbc:force="" rfc:force="" b1ie:force="" b1e:force="" xci:force="" sim:force="" utils2:force=""><xsl:output method="xml" encoding="UTF-8" indent="yes"></xsl:output><xsl:param name="atom"></xsl:param><xsl:param name="sessionid"></xsl:param><xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']"></xsl:variable><xsl:variable name="vpSender" select="/vpf:Msg/vpf:Header/vpf:Sender/@Id"></xsl:variable><xsl:variable name="vpObject" select="/vpf:Msg/vpf:Header/vpf:Sender/@ObjId"></xsl:variable><xsl:variable name="vpReceiver" select="/vpf:Msg/vpf:Header/vpf:ReceiverList/vpf:Receiver[./@handover='P']/@Id"></xsl:variable><xsl:template match="/">
<Msg xmlns="urn:com.sap.b1i.vplatform:entity">
<xsl:copy-of select="/vpf:Msg/@*"></xsl:copy-of>
<xsl:copy-of select="/vpf:Msg/vpf:Header"></xsl:copy-of>
<Body>
<xsl:copy-of select="/vpf:Msg/vpf:Body/*"></xsl:copy-of>
<Payload Role="R" id="{$atom}">
<xsl:call-template name="transform"></xsl:call-template>
</Payload>
</Body>
</Msg>
</xsl:template><xsl:template name="transform">
<FinalAtomResult xmlns="">
<BOM>
<BO>
<AdmInfo>
<Object>17</Object>
<Version>2</Version>
</AdmInfo>
<Documents>
<row>
<DocDate>
<xsl:copy-of select="$msg/io/row[0]/col[2]/text()"></xsl:copy-of>
</DocDate>
<DocDueDate>
<xsl:copy-of select="$msg/io/row[0]/col[5]/text()"></xsl:copy-of>
</DocDueDate>
<CardCode>KD10251</CardCode>
<NumAtCard>
<xsl:copy-of select="$msg/io/row[0]/col[1]/text()"></xsl:copy-of>
</NumAtCard>
<U_PMX_JD_COMP>32</U_PMX_JD_COMP>
</row>
</Documents>
<Document_Lines>
<xsl:for-each select="$msg/io/row">
<row>
<BarCode>
<xsl:copy-of select="$msg/io/row[*]/col[2]/text()"></xsl:copy-of>
</BarCode>
<Quantity>
<xsl:copy-of select="$msg/io/row[*]/col[3]/text()"></xsl:copy-of>
</Quantity>
</row>
</xsl:for-each>
</Document_Lines>Mike,
you were right, you may not specify the extension of a file.
Another thing i detected is that the loop of my data start with the index 1 instead of 0 !!!
In this scenario, i have to read all the lines of the file and each time i should do a SQL-query,
so that i can use the result to build my sales document.
Do you know if it this is possible or have you any idea how to do this ?
thx,
Mario
Maybe you are looking for
-
How to send a project from Final Cut Pro X, to adobe Audition
Anyone familiar with exporting a project or just audio from FCPX to Adobe Audition?
-
Xcode is not shown in launchpad
For some reasion I want to use older versions of xcode on my macbook pro I tried to download and install the old xcode with sdk(from 2011) just as I did on my friends computer which it worked before but this time I failed.I tried it many times the i
-
my iphone wont sync all my movies, 1 of 3 sync but not the others. They are all the same format (mp4. I can see them in itunes but they wont transfer onto the iphone.
-
How to set the timezone?
I'm trying to set the time zone of the browser, because the messages on my webmail client have an incorrect time...
-
How do I get internet for iPod Touch 4G through Computer/Laptop?
Ok well i heard that its possible to connect an iPod Touch 4G to a Computer or laptop with Internet and then have internet on the iPod so is that possible?