Sql Filesystem programming Python - python

Hi Everyone Ive hit a road block in sql. Its the dreaded storing images in sql database. Apparently the solution to this is to store image in a file system. Does anyone know any book or video tutorial that teaches this I cant seem to find any in the web. Im using My Sql and Python to learn how to work with images. I cant find any examples in the web.

Store the image as a file, and store the path of the file in the database.
The fact that the file is an image is irrelevant. If you want a more specific answer, you will need to ask a more specific question. Also, please edit your title so that it corresponds to the question.

Related

Is pytesseract safe to use with confidential images?

I am working on a project for my company which tries to read scanned pdfs and classify them depending on their contents.
After doing some research online, the easiest way to solve this seems to be by using a Python Library called pytesseract.
My question is: Is this library safe to use with images containing confidential customer data? Do the images/the extracted text get saved in some server?
I found this link which suggests that it is. But I am lacking understandment of what exactly happens 'behind the scenes' everytime I read an image with the module.
Thanks in advance for any help!

Need help me ID this file structure, and if so any way to decode it?

So I’m working with 25 years (~1100 files) of data from precipitation recorders saved in .hobo format.
The goal is to eventually save all records in one query-able database without using HOBOware software. I’m just looking for ideas. I prefer working in R, but python is an option too. (This is a student project)
P.S. Sorry for the picture of a screen, but I’m not sure how else to share these special characters. I can include a file if that helps.

How to deliver an image array from python to Rails

I am new to the world of Web Developing, i am currently using Ruby on Rails to code my webpages.
Here is the problem i am facing right now.
I am trying to make a webapp (using ruby on rails) in which the user must submit an Image(i am using CarrierWave for this) and the program its suppose to do some image processing, recognized objects and count them, so for this task i made a python script which do this automatically(using OpenCV). My problem is that the python script must return a new image which has the objects of interest in rectangles, and then i must store it in the dabase.
Currently i am returning in console where my objects are in the image, and displaying the new image, but i am not able to return the image as an array so that ruby framework can process it and upload it.
A simple view at how i am doing this
In the example1 i am recognizing oranges in the trees.
If anyone can help me or have an idea at how to do it, maybe a different approach could work. I am new in this, i have researched everywhere with no goods results. I didn't want to pose any code because i dont know which part is useful or not. (sorry for my bad english, i am not use to it completely)
To save an image locally into python you need to make an Image object and then save it to a given path.
my_image= Image("simplecv")
my_image.save("my-image.png") # in the current working directory
or to a path :
my_image.save("path/to/img.png")
You can then re-load those files with another language and store them in a database.
More examples on :
http://tutorial.simplecv.org/en/latest/examples/basics.html

Can't read in image web2py

Hello I'm having problems opening a image file in web2py. I don't know if I'm making just a simple mistake or that it'd more than that. I thought I was doing it right looking at examples from the web and on this site. Heres my code in the model:
db.define_table('image',
Field('picture', 'upload'))
I think the error means that there is a picture in the database but it can't retrieve that image and open it or I be completely wrong please if anyone can spread some light on the solution i will be very thankful
The parameter passed to Image.open, db.image.picture, is a Field object and not the value that was filled into the form. You probably want:
pic = Image.open(os.path.join(request.folder,'uploads',form.vars.picture))
Edit: Updated to use full path to the picture file. However, as pointed out by Anthony in comments below, this will not work with a blob field that was used to store the image in the original question (before it was edited as discussed in comments below). The use of retrieve as described here will provide the file data.

migrating data from tomcat .dbx files

I want to migrate data from an old Tomcat/Jetty website to a new one which runs on Python & Django. Ideally I would like to populate the new website by directly reading the data from the old database and storing them in the new one.
Problem is that the database I was given comes in the form of a bunch of WEB-INF/data/*.dbx and I didn't find any way to read them. So, I have a few questions.
Which format do the WEB-INF/data/*.dbx use?
Is there a python module for directly reading from the WEB-INF/data/*.dbx files?
Is there some external tool for dumpint the WEB-INF/data/*.dbx to an ascii format that will be parsable by python?
If someone has attempted a similar data migration, how does it compare against scraping the data from the old website? (assuming that all important data can be scraped)
Thanks!
The ".dbx" suffix has been used by various softwares over the years so it could be almost anything. The only way to know what you really have here is to browse the source code of the legacy java app (or the relevant doc or ask the author etc).
wrt/ scraping, it's probably going to be a lot of a pain for not much results, depending on the app.

Categories