OCR In Image Processing - Cannot Find TIFF File
Oct 9, 2013
class mmm {
public static void main(String[] args) {
OcrEngine ocr = new OcrEngine();
ocr.setImage(ImageStream.fromFile("pp.tif"));
// ocr.setImage((IImageStream) new File("pp.tif"));
[Code] ....
In above code giving error .
Exception in thread "main" com.aspose.ms.System.IO.FileNotFoundException: Can't find file: pp.tiff.
Where i am wrong. I am trying to pass all formt(.png,.gif,.jpg) images. I am giving proper path ....
View Replies
May 28, 2015
I need to write out multiple BufferedImages to a single tiff file. Each image represents a seismic time slice which can be several megabytes in size. I have used the TIFFEncodeParam.setExtraImages method and saved all my BufferedImages to a vector but my since I create so many BIs I keep running out of memory. Is there a way to create a BI, write it out to a TIFF file, then discard the BI and create the next one?
View Replies
View Related
Feb 13, 2015
I am trying to process an array of pixels, checking each within a 5*5 mask. Ive declared my mask as a 2d array and get the pixel values within a nested for loop. Im getting an ArrayIndexOutOfBoundsException at the line:
mask[0][4] = dsIm.red[i-1][j+3];
Have I declared my mask wrong for a 5*5 mask. Is my logic wrong?
I won't give all the code, but basically Im trying to check all 25 pixel values within the mask:
int [][] mask = new int[5][5];
System.out.println("We are in the method just written");
//loop one loop
for(int i = 1; i <= h-2; i++)
{
for(int j = 1; j<=w-2; j++)
[Code] .....
View Replies
View Related
Jun 9, 2014
The problem I am trying to solve relates to block-matching or image-within-image recognition. This is an algorithm problem I am working on in java, but computationally, my computer can't handle generating all the combinations at one time.
I see an image, extract the [x,y] of every black pixel and create a set for that image, such as
{[8,0], [9,0], [11,0]}
The set is then augmented so that the first pixel in the set is at [0,0], but the relationship of the pixels is preserved. For example, I see {[8,0], [9,0]} and change the set to {[0,0], [1,0]}. The point of the extraction is that now if I see {[4,0], [5,0]}, I can recognize that basic relationship as two vertically adjacent pixels, my {[0,0], [1,0]}, since it is the same image but only in a different location.
I have a list of these pixel sets, called "seen images". Each 'seen image' has a unique identifier, that allows it to be used as a nested component of other sets. For example:
{[0,0], [1,0]} has the identifier 'Z'
So if I see:
{[0,0], [1, 0], [5,6]}
I can identify and store it as:
{[z], [5, 6]}
The problem with this is that I have to generate every combination of [x,y]'s within the pixel set to check for a pattern match, and to build the best representation. Using the previous example, I have to check:
{[0,0], [1,0]},
{[0,0], [5,6]},
{[1,0], [5,6]} which is {[0,0], [4,5]}
{[0,0], [1,0], [5,6]}
And then if a match occurs, that subset gets replaced with it's ID, merged with the remainder of the original set, and the new combination needs to be checked if it is a 'seen image':
{[z],[5, 6]}
The point of all that is to match as many of the [x,y]'s possible, using the fewest pre-existing pieces as components, to represent a newly seen image concisely. The greedy solution to get the component that matches the largest subset is not the right one. Complexity arises in generating all of the combinations that I need to check, and then the combinations that spawn from finding a match, meaning that if some match and swap produces {[z], [1,0], [2,0]}, then I need to check (and if matched, repeat the process):
{[z], [1,0]}
{[z], [2,0]}
{[1,0], [2,0]} which is {[0,0], [1,0]}
{[z], [1,0], [2,0]}
Currently I generate the pixel combinations this way (here I use numbers to represent pixels 1 == [x,y]) Ex. (1, 2, 3, 4): Make 3 lists:
1.) 2.) 3.)
12 23 34
13 24
14
Then for each number, for each list starting at that number index + 1, concatenate the number and each item and store on the appropriate list, ex. (1+23) = 123, (1+24) = 124
1.) 2.) 3.)
12 23 34
13 24
14
---- ---- ----
123 234
124
134
So those are all the combinations I need to check if they are in my 'seen images'. This is a bad way to do this whole process. I have considered different variations / optimizations, including once the second half of a list has been generated (below the ----), check every item on the list for matches, and then destroy the list to save space, and then continue generating combinations. Another option would be to generate a single combination, and then check it for a match, and somehow index the combinations so you know which one to generate next.
How to optimize what I am doing for a set of ~million items. I also have not yet come up with a non-recursive or efficient way to handle that each match generates additional combinations to check.
View Replies
View Related
Jan 8, 2015
How can I find the DPI of an image? The following code tells me the size of the image in pixels which I want to convert to millimetres. When I have looked at conversions I can find - "mm = (pixels * 25.4) / dpi" but how do I find out the DPI?
public class NewMain {
/**
* @param args the command line arguments
* @throws java.io.IOException
*/
public static void main(String[] args) throws IOException {
String filename = null;
BufferedImage bimg = ImageIO.read(new File("testimage.jpg"));
int width = bimg.getWidth();
[Code]...
View Replies
View Related
Apr 17, 2014
I'm getting this -file not found- error despite the fact that I have saved the file with appropriate permissions in the src folder of the given application in netbeans. The program prompts for a listings.txt file to read and write data to a new file that counts and sums the info in a overview.txt report. Here is the stacktrace:
run:
Type in the name of the file: listings
There was a problem:java.io.FileNotFoundException: listings.txt (The system cannot find the file specified)
java.io.FileNotFoundException: listings.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:131)
at java.io.FileInputStream.<init>(FileInputStream.java:87)
at java.io.FileReader.<init>(FileReader.java:58)
at kettask2a.KetTask2a.main(KetTask2a.java:48)
[code]....
View Replies
View Related
Feb 2, 2015
I'm trying to find a specific file that already exists on the computer. I want to find that file and zip it. don't get sidetracked with whether or not the file exists, because I'm sure it does on my local machine and TDD will address that what-if scenario later.
My code and JUnit is below. Since its not finding the file, I assume I must be formatting 'path' wrong. I wonder if I'm even on the right track logically.
private ZipParameters zp = new ZipParameters();
private ZipFile zipFile;
public ZipFile createZipFile(File f, String path) throws ZipException{
zipFile = new ZipFile(path);
zp.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
zp.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
[Code] ....
View Replies
View Related
Sep 30, 2014
I already done my program with images on it but when i convert it to exe , the images is not appearing.
Usually my images are located at documents netbeansprojectprojectimage.jpg
When i run the code on netbeans the images are appearing but when i convert it to exe or jar file run on a computer without netbeans.. images is not appearing ...
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.ImageIcon;
class Phonebook extends JFrame {
private static final int WIDTH = 430;
private static final int HEIGHT = 200;
public Phonebook()
[Code] ....
View Replies
View Related
Jul 3, 2014
Gyazo - e5663e8da42ac46a642895d72836b933.png
As you can see I have specified a file path, as it is needed to draw the image.
The image "sun" is in a certain folder inside the directory of my jar file.
But If I were to send the whole package to my teacher to review. The file path would still remain the same, local to my computer making the image, unloadable.?
View Replies
View Related
Sep 8, 2014
I am trying to read an image I have in the location of my project, So I do this:
When I read it in the try/catch like: BufferedImage image = ImageIO.read(new file(""));
And try to access it after the try/catch, it does not know that image exists, so I need to declare it as a global variable for that class first, and then it works.
public class Gui extends JFrame
{
private BufferedImage image1;
public Gui() {
super("MyApp");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
initUI();
[Code] ....
View Replies
View Related
Sep 2, 2014
I'm trying to read a .xlsx file using Apache Poi on Eclipse and store the data into an ArrayList.
My code :
import org.apache.poi.ss.usermodel.*;
import java.io.*;
import java.util.*;
public class parseReadFiles
{
public static void main(String[] args) {
[Code] ....
I keep getting a FileNotFoundException: Users/Divjot/Desktop/first.xlsx (No such file or directory). I've tried different combinations of file names and paths but can't get the program to find it. Should the file be stored in a special place or should the class path be different?
View Replies
View Related
Jul 30, 2014
I get a Base64Encoded image string (GIF format) from an external system. While reading the byte array and saving the image to file, the image gets saved in landscape orientation. The code snippet is below.
String image = "R0lGODdhCAcgA=";
Base64Coder decoder = new Base64Coder();
byte [] decodeBytes = decoder.decode(image.getBytes());
ByteArrayInputStream stream = new ByteArrayInputStream(pngArray);
BufferedImage bImage = ImageIO.read(stream);
File label = new File("C:/labels/test.gif");
ImageIO.write(bImage, "gif", label);
I want to save the image in portrait orientation. Is there a way to do that?
View Replies
View Related
Jun 24, 2014
First of all, i am using ubuntu and jdk8. My problem: displaying the current path of a file in my system Approach: I have a file called dummy.txt in a given directory which have enough permissions and i did the following:
File file=new File("dummy.txt");
System.out.println(file.getAbsolutePath().substring(0,file.getAbsolutePath().lastIndexOf("/")));
I expected to see displayed the current path of the file without the name of the file but it is showing a different path. I just want to display the current path of the file without the name.
View Replies
View Related
Feb 13, 2014
I am working through a text and I am supposed to complete the following tasks.
Your ReadFiles.java class requires the following methods:
Method: check to see if the file exists
Method: find number of rows in csv file
Method: Converts the csv file to a mutli-dimensional array
Method: PrintArray
Method: Return array using a get method
Create a file DataAnalyzer.java. This file will be used to call the methods in ReadFiles.java. Be sure to demonstrate that all of your methods work through DataAnalyzer.java.
The problem is that it does not really provide any information on how to go about reading a file into an array. I am stuck at the third task of converting the file to an array and I have tried several ways to do this unsuccessfully. I thought that I would at least try to get things to print out (line 87) to see if I could get that to work, but all that prints in null over and over again.
Java Code:
public class DataAnalyzer {
public static void main (String[] args) {
ReadFiles aReadFiles = new ReadFiles();
aReadFiles.fileCheck();
aReadFiles.findRows();
aReadFiles.convertFile();
[Code] .....
View Replies
View Related