Web Services :: Matching Images Pattern Recognition

Nov 27, 2014

I want to know that is it possible to match images in java and used in web? how is it possible?

View Replies


ADVERTISEMENT

Image Processing Pattern Matching / Combination Algorithm

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

GUI Memory Game - Matching Images

Jun 30, 2014

Making a memory game where you click a square it turns over an image and you match the two pretty simple. My issue is my images are not displaying and I am not sure why everything looks correct to me.

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.util.Random;
public class MemoryApp extends JFrame {
static String Pics[] = {"beaver.JPG", "dawgs.jfif",

[Code] ....

View Replies View Related

Voice Recognition Using Java

Jul 16, 2014

I have been working with java for some time now.. I wish to develop a stand alone application, which can recognize voice and perform actions accordingly. The issue is Oracle does not directly provide any support here... there are 3rd party applications that implement the java speech api.. I am not finding these 3rd party api's, even if i do they have a few lib jar files missing...

View Replies View Related

How To Execute And Use Win7 Speech Recognition

May 26, 2014

I want to execute and use the Win7 Speech Recognition with Java. How can I open it?

I tried to open it with "Runtime.getRuntime().exec(" ");" but I couldn't find a command to open it. How can I use the speech recognition once I opened it with commands in Java?

View Replies View Related

How To Create Sample Optical Mark Recognition To Extract Data In Java

Nov 10, 2014

my idea is auto recognize when i put image like survey and that survey has shape box and it random area location and some shape box also character and number and can generated data that recognize in csv file.

View Replies View Related

Putting Images In GUI / Images In Source File Don't Seem To Be Recognized

Jun 7, 2014

This is my class with the GUI:

import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JPasswordField;

[code]....

Eclipse error message:

Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:205)
at GUI.<init>(GUI.java:26)
at Apples.main(Apples.java:7)

i think the problem is to do with my images not being recognised. I put them in my source in User>...>workspace>src which is correct as far as i know. From what i know the images should show up if i look at my src file in eclipse but they dont. I tried changing the file type from .png to .jpg but it makes no difference.

View Replies View Related

Matching Grouping Symbols

Nov 27, 2014

I need to write a program that checks whether a Java source-code file has correct pairs of grouping symbols and the program must implement the Stack<E> class to solve this problem.

Here is the file:
[a({b,c}x{d,e})%x]
(1+(2-3)/4+[(a-({b+c}*5)/2)+e]
(a{b(c]}a)

I tried something like this, but I'm not exactly sure what I am doing wrong:

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.Stack;
public class Driver {

[Code] .....

View Replies View Related

Java Matching Game

Apr 14, 2015

I'm working on a Java matching game and I'm having a hard time wrapping my mind around it. What I'm having trouble with is how exactly to create an array so that my squares have random values. Then how do I get it to reveal and compare those values by clicking on two of them? Here is what I have so far:

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

[code]....

View Replies View Related

Name And Address Matching From Oracle Database

Apr 26, 2015

I need a java program for getting name and address matching from oracle database. I need get all the customer name and address belonging to same person even if there is slight name and address changes are there.

James Smith
123 Broadway Av
Brownville, ME 04415

James S
123 Brodway Avenue
Brownville Junction, ME 04451

I am unable to get a best code for this and trying since long time.

View Replies View Related

Exception In Matching Parentheses Using Stacks

May 11, 2014

I am trying to write a program that checks for parentheses matching using stacks.This is my ArrayStack class.

public class ArrayStack{
private final int DEFAULT_SIZE=10;
public int tos;
Object[] array;
public ArrayStack(){
array=new Object[DEFAULT_SIZE];

[Code] ....

But the problem is when I compile matching I get an error as unreported exception EmptyStackException.must be caught or declared to be thrown. I think the problem is with exceptions which I don't have a good knowledge of.

View Replies View Related

Java Matching Braces Program?

Apr 17, 2014

Here if we give input from a text file from a disk and (a[b+c{d}]-v) is true and{a-(b]} is false but i get some syntax errors ...

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Stack;
public class Syste {
private static String expr;

[code]....

View Replies View Related

Matching Drawn Card To Its GIF In ArrayList?

May 4, 2015

I'm creating a card game and I'm having trouble getting a card gif to display. A card is drawn from an 52 card deck arraylist, and I then need to match that drawn card with the similarly named gif in an arraylist of card gifs, to display the gif on a card GUI. I have put my game, card, deck and graphical class below:

Card -
public class Card {
public String number;
public String suit;
public Card(String n, String s) {
number = n;
suit = s;

[Code] ....

The arrayList of card gifs (which contains all 52 gifs for the cards) is in the graphical class and my arrayList that contains the deck of cards in textual form (that I've imported from a textfile) is in deck. The names of the gifs in the gif arraylist are the same as the card names in my textual card arraylist (for example, 3h.gif is 3h in my card arraylist), so I believe I can use a .equals statement to match the card that has been drawn to the gif.

Here is what the gifs look like in their folder, which is an arraylist in my graphical class :

Here is what the drawn card looks like after the textual card arraylist has been shuffled:

The brown card in that image isn't the displayed card that has been drawn, it's just a graphical deck that I put in, I can't get the card that has been drawn on the GUI to display on the actual card frame, as you can see.

View Replies View Related

Copy Matching Numbers From Two Arrays Onto New One

Jun 4, 2014

I want my function to return an array, with the array holding just the values of data that appear in good.

This is what should be returned:

{3, 5, 3, 2, 3, 3}

What is currently being returned:

{0, 3, 5, 3}

I didn't want to miss any numbers, so I decided to iterate through j for the "good" array, and then just i for the one that I was looking for matching numbers. Perhaps part of the problem is that if the condition is met, it goes to the next iteration of the loop. I'm not sure.

public class Arrays2 {
public static void main(String args[]){
int [] data = {8, 3, 5, 3, 7, 2, 8, 3, 3 };
int [] good = {5, 2, 3, 2};
int [] result = f2(data, good);
for (int i = 0; i < result.length; i++){

[Code] ....

View Replies View Related

Java Memory Matching Game

Feb 13, 2015

"A common memory matching game played by young children is to start with a deck of cards that contain identical pairs. For example, given six cards in the deck, two might be labeled

1, two might be labeled
2 and two might be labeled
3. The cards are shuffled and placed face down on the table.

The player then selects two cards that are face down, turns them face up, and if they match they are left face up. If the two cards do not match they are returned to their original position face down. The game continues in this fashion until all cards are face up.Write a program that plays the memory matching game. Use sixteen cards that are laid out in a 4x4 square and are labeled with pairs of numbers from 1 to 8. Your program should allow the player to specify the cards that she would like to select through a coordinate system.For example in the following layout:

1 2 3 4
--------------------
1 | 8 * * *
2 | * * * *
3 | * 8 * *
4 | * * * *

All of the cards are face down except for the pair 8 which has been located at coordinates (1,1) and (2,3). To hide the cards that have been temporarily placed face up, output a large number of newlines to force the old board off the screen.Use 2D array for the arrangement of cards and another 2D array that indicates if a card is face up or face down.Or, a more elegant solution is to create a single 2D array where each element is an object that stores both the cards value and face.Write a function that shuffles the cards in the array by repeatedly selecting two cards at random and swapping them.

Note:To generate a random number x, where 0<= x <1, use x=Math.random();.For example, multiplying y six and converting to an integer results in an integer that is from 0 to 5."I have been thinking about the algorithm and design of the question for a few hours.

View Replies View Related

Lottery Game Matching Numbers Error

Dec 11, 2014

import java.util.Scanner;
import java.util.Arrays;
public class LotteryTester {
public static void main(String[] args) { 
LotteryApplication lottery = new LotteryApplication();
int lotteryNumbersCount = lottery.getLotteryNumbers().length;
 
 [Code] ....

Everything works fine but when I run it the matching numbers tends to be off. For example I will type Enter in 1,1,1,1,1 for my 5 numbers. The lottery numbers will be 5,3,4,5,8 and it will say 1 number matched.

View Replies View Related

Swing/AWT/SWT :: Matching Strings To Selected Rows In JTable

Nov 10, 2014

I have a JTable which shows pdf files. In Addition I can check if they have errors, if it so I can generate a "report" by clicking the pdf. But the report gives me errors from all of the pdfs in the table. How can I match the error messages to the pdf which I select?

Here is one of the checking methods:

public static void testAllPagesHaveSameRotation(PDFDocument pdf) throws PDFDocumentException {
if (SettingsGui.testAllPagesHaveSameRotation.isSelected()) {
if (pdf.getPages() == 0) {
rotationError = "";
} else {
rotationError = "";

[Code] ....

View Replies View Related

Searching Large Char Array For Matching Substrings

Feb 10, 2015

I have written an algorithm that compares the chars and returns all the found words in a 20x10 puzzle, but not for a 100x50 puzzle.

The puzzles are loaded in via text file and I have confirmed they're loading correctly.

guesses = String[] of search words
puzzle = char[][] of letters

Why it doesn't work on the large array?

Expected output:
word1, word2, word3

Actual output:
[blank line]

Here's the horizontal algorithm (row by row search)

//temp variable
ArrayList<String> temp = new ArrayList<String>();
try {
//for each guess word
for(String word : guesses) {
int count = 0;

[Code] .....

View Replies View Related

Non-Public Class In A Source File Doesn't Matching Its Name

Oct 20, 2014

I have a question about the following snippet concerning the steps the javac compiler follows to compile a program:

[...]at first, searching a class within a package is discussed if the latter doesn't contain a full package name[...]

It is a compile-time error if more than one class is found. (Classes must be unique, so the order of the import statements doesn't matter.)

The compiler goes one step further. It looks at the source files to see if the source is newer than the class file. If so, the source file is recompiled automatically. Recall that you can import only public classes from other packages. A source file can only contain one public class, and the names of the file and the public class must match. Therefore, the compiler can easily locate source files for public classes.

However, you can import nonpublic classes from the current package. These classes may be defined in source files with different names. If you import a class from the current package, the compiler searches all source files of the current package to see which one defines the class. I don't quite understand the red fragment. I wondered if the word "import" nonpublic classes from the current package weren't a synonym for the word "use", since why would we want to import a class from the same package when compiler searches the current package automatically anyway?

However I wanted to test nonpublic classes that are contained in source file which name doesn't match the class name:

NonpublicClass.java:

Java Code:

package com.work.company;
class NonpublicClass
{
public void description() {
System.out.println("Working!");
}
} mh_sh_highlight_all('java');

[Code] ....

Everything's fine when the source file names are the same as above. However, when I change NonpublicClass.java to a different name, there's an error "cannot find symbol" in:

Java Code: NonpublicClass v = new NonpublicClass(); mh_sh_highlight_all('java');

I noticed that the class file for NonpublicClass isn't even generated so that's probably the cause. If I change to the directory of the package the NonpublicClass is contained in and compile it directly, i.e. issue for example:

Java Code: javac NonpublicClass_different_name.java mh_sh_highlight_all('java');

Then a proper class file is generated with the class name, that is NonpublicClass.class, and afterwards I can compile the main program in Start.java.

So the question is what am I missing regarding the cited quote that reads:

If you import a class from the current package, the compiler searches all source files of the current package to see which one defines the class.

? Because adding such an import to CompanyClass.java:

import com.work.company.NonpublicClass;

didn't work either...

View Replies View Related

Compare 2 Strings - Generate New String With Matching Characters

Jul 3, 2014

I'm attempting a small program as I'm teaching myself the ropes. In it, I need to compare one string (the base) to another which is just the base string that's had it's characters shuffled.

Java Code:

String base = "ABCDEFG"
String shuffled = "CDAFBEG" mh_sh_highlight_all('java');

What I need to do is run a loop that shuffles the base string each time, but compares and saves any characters that match in the correct location. For example, if shuffled = "CDAFBEG", then the G would be "locked" in place and the rest of the characters shuffled and looped back to the comparison.

I have all the code I need for shuffling the string, but I'm not sure how I would go about comparing each character and then also locking it in place. I get the basics, I think, of needed to use several variables.

View Replies View Related

How To Add Spaces To A Pattern

Apr 21, 2015

I have created this program that outputs

1
12
123
1234
12345
123456

I tried looking up some ways to create spaces in between each number, but I failed miserably. Here is what I have right now.

public class Iterations {
public static void main(String[] args){
for(int i=1;i<=6;i++)
{
for(int j=1;j<=i;j++)
System.out.print(j);

[Code] ....

View Replies View Related

Printing Pattern When Name Is Given

Mar 10, 2014

I want to know how to print this type of pattern when a name is given ???

Example:

name given TEJA

Capture.PNG

View Replies View Related

How To Apply Format Pattern

Jan 12, 2015

I am able to get Cpu speed using my GetProcessorSpeed method and It returns this output 1796. How can apply this pattern "#.##". I am trying something like this.

Format formatter=new DecimalFormat("#.##");
formatter.format(MainClass.GetProcessorSpeed());
label2.setText(formatter.toString());

View Replies View Related

Head First Design Pattern

Jan 11, 2014

I was reading head first java and the author told to read head first design pattern next.

View Replies View Related

String Pattern Match

Apr 24, 2015

Why the following string fails the test below:

@Pattern(regexp = "^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*.(([0-9]{1,3})|" +
"([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$", message = "Not a well-formed email address")

View Replies View Related

Pattern Matches In Java

Jul 3, 2014

I have code which validate code enter by user

the requirement say the maxlength=2 and minlength=1 and is a string

the user can enter code as follows

00
A1
HH
12
10
09

I have this Java Code:

public boolean isValidPattern(String s_value, String s_pattern) {
boolean flag = false;
if (Pattern.matches(s_pattern, s_value)) {
flag = true;
}
return flag;

[Code] ....

My problem is when user put

A1 AM geting error

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved