Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python analysing image
#1
Hey guys. I have a project to do and I'm in chaos. I have data from a camera that shows the spots of the incident electrons. The camera saves each image in txt files but there are some letters in the beggining that make my life difficult. I want to open this txt file and view the image of the matxrix from a certain line and the rest. the matrix consists only 0 and1 depending on the electron, if it hit the certain spot or not. then i need to sum every column and create the spectrum of it. if someone has the time to help me I would really appreciate it! thank you in advance
Reply
#2
(Nov-15-2016, 08:24 PM)Aggeliki Wrote: ... The camera saves each image in txt files but there are some letters in the beggining that make my life difficult. I want to open this txt file and view the image of the matxrix from a certain line and the rest.

Not sure what your saying here, why would the 'camera' save a picture as a text file? Every file contains a magic number/signature at the very beginning that describes information necessary to interact with that file type (you can see this info with a hex editor). Perhaps you could supply a portion of this 'text file'?
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
(Nov-15-2016, 08:37 PM)sparkz_alot Wrote:
(Nov-15-2016, 08:24 PM)Aggeliki Wrote: ... The camera saves each image in txt files but there are some letters in the beggining that make my life difficult. I want to open this txt file and view the image of the matxrix from a certain line and the rest.
Not sure what your saying here, why would the 'camera' save a picture as a text file? Every file contains a magic number/signature at the very beginning that describes information necessary to interact with that file type (you can see this info with a hex editor). Perhaps you could supply a portion of this 'text file'?

Actually I wasn't at the experiment so I don't know for sure if it was a camera.. All I know is that I have this txt (which unfortunately I can't provide now because I'm not on the pc from work ) which can be used as an array, I gues.. So long I have written this code:
import numpy as np
import pylab as p

path = "/home/users2/afentaki/Bureau/afentaki.a/2015_SOLEIL/friday/"

file_name = "CO2_C1s_100"

stkin = input("what's the kinetic energy at the beginning?" )
endkin = input("what's the kinetic energy at the end?")
step = input("what's the step?" )

numspots = ( endkin - stkin ) / step 

line = input ("what's the line that the array begins? ")


mat = np.genfromtxt( path + file_name, delimiter = '', skip_header = line) 


p.figure
p.pcolor(mat)

from PIL import mat 
img = mat.open('151116.png')
img.show()

second = np.sum(mat, axis = 0 )
img = second.open('151116.png')
img.show()
but I get a lot of errors that I have no idea how to fix
Reply
#4
Please post the Traceback error in error code tags when you have errors with you codes.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  need help with data analysing with python and sqlite Hardcool 2 351 Jan-30-2024, 06:49 AM
Last Post: Athi
  Upload image to Instagram using python/selenium using image URL failed, need help greenpine 5 5,436 Feb-22-2022, 09:42 PM
Last Post: snippsat
  Analysing XML file rowan_bradley 1 1,597 Aug-24-2020, 02:45 PM
Last Post: ndc85430
  PIL Image / python-resize-image AttributeError sallyjc81 1 4,974 Aug-02-2020, 12:06 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020