Moved some methods. and fixed the image blur filter
This commit is contained in:
parent
ed68e21b05
commit
40b5173abe
8 changed files with 140 additions and 281 deletions
|
|
@ -1,171 +0,0 @@
|
||||||
#
|
|
||||||
# An unexpected error has been detected by Java Runtime Environment:
|
|
||||||
#
|
|
||||||
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77cfb15f, pid=1104, tid=5336
|
|
||||||
#
|
|
||||||
# Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode)
|
|
||||||
# Problematic frame:
|
|
||||||
# C [ntdll.dll+0x3b15f]
|
|
||||||
#
|
|
||||||
# If you would like to submit a bug report, please visit:
|
|
||||||
# http://java.sun.com/webapps/bugreport/crash.jsp
|
|
||||||
#
|
|
||||||
|
|
||||||
--------------- T H R E A D ---------------
|
|
||||||
|
|
||||||
Current thread (0x0b570400): JavaThread "Connection Thread" [_thread_in_native, id=5336]
|
|
||||||
|
|
||||||
siginfo: ExceptionCode=0xc0000005, writing address 0x00000014
|
|
||||||
|
|
||||||
Registers:
|
|
||||||
EAX=0x00000000, EBX=0xfffffffc, ECX=0x00000000, EDX=0x00000004
|
|
||||||
ESP=0x0bc3efe8, EBP=0x0bc3f038, ESI=0x0ba590bc, EDI=0x0ba590c0
|
|
||||||
EIP=0x77cfb15f, EFLAGS=0x00010213
|
|
||||||
|
|
||||||
Top of Stack: (sp=0x0bc3efe8)
|
|
||||||
0x0bc3efe8: 0ba590bc 0ba590c0 00000000 001d4290
|
|
||||||
0x0bc3eff8: 00000000 00000000 0bc3f07c 75a64c14
|
|
||||||
0x0bc3f008: 00000424 00000420 00000002 75a63f42
|
|
||||||
0x0bc3f018: cacfe3c5 0bc3f108 0bc3f114 00000000
|
|
||||||
0x0bc3f028: 00000000 00000000 7ffae000 000002f0
|
|
||||||
0x0bc3f038: 0bc3f060 77cfb071 00000000 00000000
|
|
||||||
0x0bc3f048: 00000000 0b946e80 00000000 00000004
|
|
||||||
0x0bc3f058: 00000000 00000001 0bc3f0f0 20b0447e
|
|
||||||
|
|
||||||
Instructions: (pc=0x77cfb15f)
|
|
||||||
0x77cfb14f: ff 33 c0 89 45 0c 89 45 08 8b 06 83 f8 ff 74 04
|
|
||||||
0x77cfb15f: 83 40 14 01 8b 5d f4 8b 7d f0 90 80 3d 82 03 fe
|
|
||||||
|
|
||||||
|
|
||||||
Stack: [0x0bbf0000,0x0bc40000), sp=0x0bc3efe8, free space=315k
|
|
||||||
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
|
|
||||||
C [ntdll.dll+0x3b15f]
|
|
||||||
C [ntdll.dll+0x3b071]
|
|
||||||
C [imon.dll+0x447e]
|
|
||||||
|
|
||||||
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
|
|
||||||
j java.net.SocketInputStream.socketRead0(Ljava/io/FileDescriptor;[BIII)I+0
|
|
||||||
j java.net.SocketInputStream.read([BII)I+84
|
|
||||||
j java.io.BufferedInputStream.fill()V+175
|
|
||||||
J java.io.BufferedInputStream.read()I
|
|
||||||
j java.io.DataInputStream.readByte()B+4
|
|
||||||
j org.eclipse.jem.internal.proxy.vm.remote.ConnectionHandler.run()Ljava/lang/Object;+54
|
|
||||||
j org.eclipse.jem.internal.proxy.vm.remote.ConnectionThread.run()V+4
|
|
||||||
v ~StubRoutines::call_stub
|
|
||||||
|
|
||||||
--------------- P R O C E S S ---------------
|
|
||||||
|
|
||||||
Java Threads: ( => current thread )
|
|
||||||
0x0be61000 JavaThread "AWT-Windows" daemon [_thread_in_native, id=1640]
|
|
||||||
0x0be4ac00 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3032]
|
|
||||||
=>0x0b570400 JavaThread "Connection Thread" [_thread_in_native, id=5336]
|
|
||||||
0x0148ec00 JavaThread "Server Thread-Project (ZUtil)-Beaninfo" [_thread_blocked, id=5880]
|
|
||||||
0x01448800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5052]
|
|
||||||
0x01433c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4504]
|
|
||||||
0x01432800 JavaThread "Attach Listener" daemon [_thread_blocked, id=3072]
|
|
||||||
0x01432400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=704]
|
|
||||||
0x01424800 JavaThread "Finalizer" daemon [_thread_blocked, id=4056]
|
|
||||||
0x01418400 JavaThread "Reference Handler" daemon [_thread_blocked, id=4536]
|
|
||||||
0x01388800 JavaThread "main" [_thread_blocked, id=340]
|
|
||||||
|
|
||||||
Other Threads:
|
|
||||||
0x01414000 VMThread [id=4904]
|
|
||||||
0x0144a800 WatcherThread [id=2452]
|
|
||||||
|
|
||||||
VM state:not at safepoint (normal execution)
|
|
||||||
|
|
||||||
VM Mutex/Monitor currently owned by a thread: None
|
|
||||||
|
|
||||||
Heap
|
|
||||||
def new generation total 960K, used 840K [0x03490000, 0x03590000, 0x03970000)
|
|
||||||
eden space 896K, 86% used [0x03490000, 0x03552328, 0x03570000)
|
|
||||||
from space 64K, 100% used [0x03570000, 0x03580000, 0x03580000)
|
|
||||||
to space 64K, 0% used [0x03580000, 0x03580000, 0x03590000)
|
|
||||||
tenured generation total 4096K, used 973K [0x03970000, 0x03d70000, 0x07490000)
|
|
||||||
the space 4096K, 23% used [0x03970000, 0x03a63430, 0x03a63600, 0x03d70000)
|
|
||||||
compacting perm gen total 12288K, used 5126K [0x07490000, 0x08090000, 0x0b490000)
|
|
||||||
the space 12288K, 41% used [0x07490000, 0x07991a68, 0x07991c00, 0x08090000)
|
|
||||||
No shared spaces configured.
|
|
||||||
|
|
||||||
Dynamic libraries:
|
|
||||||
0x00400000 - 0x00423000 C:\Program Files\Java\jre1.6.0_03\bin\javaw.exe
|
|
||||||
0x77cc0000 - 0x77dde000 C:\Windows\system32\ntdll.dll
|
|
||||||
0x774d0000 - 0x775a8000 C:\Windows\system32\kernel32.dll
|
|
||||||
0x76890000 - 0x7694f000 C:\Windows\system32\ADVAPI32.dll
|
|
||||||
0x77630000 - 0x776f3000 C:\Windows\system32\RPCRT4.dll
|
|
||||||
0x77910000 - 0x779ae000 C:\Windows\system32\USER32.dll
|
|
||||||
0x76710000 - 0x7675b000 C:\Windows\system32\GDI32.dll
|
|
||||||
0x77e00000 - 0x77e1e000 C:\Windows\system32\IMM32.DLL
|
|
||||||
0x77bf0000 - 0x77cb7000 C:\Windows\system32\MSCTF.dll
|
|
||||||
0x77b40000 - 0x77bea000 C:\Windows\system32\msvcrt.dll
|
|
||||||
0x77e20000 - 0x77e29000 C:\Windows\system32\LPK.DLL
|
|
||||||
0x76600000 - 0x7667d000 C:\Windows\system32\USP10.dll
|
|
||||||
0x10000000 - 0x10015000 C:\Windows\system32\APSHook.dll
|
|
||||||
0x76950000 - 0x769a5000 C:\Windows\system32\SHLWAPI.dll
|
|
||||||
0x76400000 - 0x76408000 C:\Windows\system32\VERSION.dll
|
|
||||||
0x76570000 - 0x76577000 C:\Windows\system32\PSAPI.DLL
|
|
||||||
0x76000000 - 0x76194000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6000.16386_none_5d07289e07e1d100\comctl32.dll
|
|
||||||
0x7c340000 - 0x7c396000 C:\Program Files\Java\jre1.6.0_03\bin\msvcr71.dll
|
|
||||||
0x6d7c0000 - 0x6da0a000 C:\Program Files\Java\jre1.6.0_03\bin\client\jvm.dll
|
|
||||||
0x75730000 - 0x75763000 C:\Windows\system32\WINMM.dll
|
|
||||||
0x777c0000 - 0x77904000 C:\Windows\system32\ole32.dll
|
|
||||||
0x76680000 - 0x7670c000 C:\Windows\system32\OLEAUT32.dll
|
|
||||||
0x756f0000 - 0x75728000 C:\Windows\system32\OLEACC.dll
|
|
||||||
0x763a0000 - 0x763cc000 C:\Windows\system32\apphelp.dll
|
|
||||||
0x6d310000 - 0x6d318000 C:\Program Files\Java\jre1.6.0_03\bin\hpi.dll
|
|
||||||
0x6d770000 - 0x6d77c000 C:\Program Files\Java\jre1.6.0_03\bin\verify.dll
|
|
||||||
0x6d3b0000 - 0x6d3cf000 C:\Program Files\Java\jre1.6.0_03\bin\java.dll
|
|
||||||
0x6d7b0000 - 0x6d7bf000 C:\Program Files\Java\jre1.6.0_03\bin\zip.dll
|
|
||||||
0x6d570000 - 0x6d583000 C:\Program Files\Java\jre1.6.0_03\bin\net.dll
|
|
||||||
0x765d0000 - 0x765fd000 C:\Windows\system32\WS2_32.dll
|
|
||||||
0x77df0000 - 0x77df6000 C:\Windows\system32\NSI.dll
|
|
||||||
0x20b00000 - 0x20b4b000 C:\Windows\system32\imon.dll
|
|
||||||
0x75ad0000 - 0x75ad7000 C:\Windows\system32\WSOCK32.dll
|
|
||||||
0x75a60000 - 0x75a9b000 C:\Windows\system32\mswsock.dll
|
|
||||||
0x75ac0000 - 0x75ac6000 C:\Windows\System32\wship6.dll
|
|
||||||
0x75690000 - 0x75696000 C:\Windows\System32\wshtcpip.dll
|
|
||||||
0x754f0000 - 0x754ff000 C:\Windows\system32\NLAapi.dll
|
|
||||||
0x75c90000 - 0x75ca9000 C:\Windows\system32\IPHLPAPI.DLL
|
|
||||||
0x75c50000 - 0x75c85000 C:\Windows\system32\dhcpcsvc.DLL
|
|
||||||
0x75ec0000 - 0x75eeb000 C:\Windows\system32\DNSAPI.dll
|
|
||||||
0x76410000 - 0x76424000 C:\Windows\system32\Secur32.dll
|
|
||||||
0x75c40000 - 0x75c47000 C:\Windows\system32\WINNSI.DLL
|
|
||||||
0x75c20000 - 0x75c40000 C:\Windows\system32\dhcpcsvc6.DLL
|
|
||||||
0x73360000 - 0x73368000 C:\Windows\System32\winrnr.dll
|
|
||||||
0x77480000 - 0x774c9000 C:\Windows\system32\WLDAP32.dll
|
|
||||||
0x73350000 - 0x7335f000 C:\Windows\system32\napinsp.dll
|
|
||||||
0x73330000 - 0x73342000 C:\Windows\system32\pnrpnsp.dll
|
|
||||||
0x73320000 - 0x7332c000 C:\Windows\system32\wshbth.dll
|
|
||||||
0x779b0000 - 0x77b39000 C:\Windows\system32\SETUPAPI.dll
|
|
||||||
0x733f0000 - 0x733f6000 C:\Windows\system32\rasadhlp.dll
|
|
||||||
0x6d000000 - 0x6d1c3000 C:\Program Files\Java\jre1.6.0_03\bin\awt.dll
|
|
||||||
0x73750000 - 0x73791000 C:\Windows\system32\WINSPOOL.DRV
|
|
||||||
0x74350000 - 0x7438f000 C:\Windows\system32\uxtheme.dll
|
|
||||||
0x01180000 - 0x01198000 c:\Program Files\Bioscrypt\VeriSoft\Bin\ItClient.dll
|
|
||||||
0x74980000 - 0x74a06000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.6000.16386_none_87e0cb09378714f1\Comctl32.dll
|
|
||||||
0x73010000 - 0x7301c000 C:\Windows\system32\dwmapi.dll
|
|
||||||
|
|
||||||
VM Arguments:
|
|
||||||
jvm_args: -Dproxyvm.registryKey=11131376 -Dproxyvm.masterPort=54959 -Dproxyvm.bufsize=16000 -Dproxyvm.servername=Project (ZUtil)-Beaninfo -Xverify:none
|
|
||||||
java_command: org.eclipse.jem.internal.proxy.vm.remote.RemoteVMApplication
|
|
||||||
Launcher Type: SUN_STANDARD
|
|
||||||
|
|
||||||
Environment Variables:
|
|
||||||
CLASSPATH=.;C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJava.zip
|
|
||||||
PATH=C:\Program Files\Java\jre1.6.0_03\bin\client;C:\Program Files\Java\jre1.6.0_03\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem;c:\program files\common files\roxio shared\dllshared\;c:\program files\common files\roxio shared\dllshared\;c:\program files\common files\roxio shared\9.0\dllshared\;c:\program files\bioscrypt\verisoft\bin;C:\Program Files\MATLAB\R2007a\bin;C:\Program Files\MATLAB\R2007a\bin\win32;C:\Program\Dev-Cpp\libexec\gcc\mingw32\3.4.2;C:\Program Files\Smart Projects\IsoBuster;C:\Program Files\Autodesk\Backburner\;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files\Java\jdk1.6.0_02\bin;C:\Program Files\QuickTime\QTSystem\
|
|
||||||
USERNAME=Ziver
|
|
||||||
OS=Windows_NT
|
|
||||||
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 10, GenuineIntel
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------- S Y S T E M ---------------
|
|
||||||
|
|
||||||
OS: Windows Vista Build 6000
|
|
||||||
|
|
||||||
CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 15 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3
|
|
||||||
|
|
||||||
Memory: 4k page, physical 2094912k(757952k free), swap 4194303k(1884172k free)
|
|
||||||
|
|
||||||
vm_info: Java HotSpot(TM) Client VM (1.6.0_03-b05) for windows-x86, built on Sep 24 2007 22:24:33 by "java_re" with unknown MS VC++:1310
|
|
||||||
|
|
||||||
|
|
@ -147,59 +147,6 @@ public abstract class ImageFilterProcessor {
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Copies the given array to a new one that it returns
|
|
||||||
* @param data The data to duplicate
|
|
||||||
* @param cols The amount of columns
|
|
||||||
* @param rows The amount of rows
|
|
||||||
* @return The array copy
|
|
||||||
*/
|
|
||||||
public static int[][][] copyArray(int[][][] data,int cols,int rows){
|
|
||||||
int[][][] copy = new int[rows][cols][4];
|
|
||||||
for(int y=0; y<rows ;y++){
|
|
||||||
for(int x=0; x<cols ;x++){
|
|
||||||
copy[y][x][0] = data[y][x][0];
|
|
||||||
copy[y][x][1] = data[y][x][1];
|
|
||||||
copy[y][x][2] = data[y][x][2];
|
|
||||||
copy[y][x][3] = data[y][x][3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method clips the values of the pixel so that they
|
|
||||||
* are in the range 0-255
|
|
||||||
* @param data The image data
|
|
||||||
* @param cols The amount of columns
|
|
||||||
* @param rows The amount of rows
|
|
||||||
*/
|
|
||||||
public static void clip(int[][][] data, int cols, int rows){
|
|
||||||
for(int y=0; y<rows ;y++){
|
|
||||||
for(int x=0; x<cols ;x++){
|
|
||||||
data[y][x][1] = clip(data[y][x][1]);
|
|
||||||
data[y][x][1] = clip(data[y][x][2]);
|
|
||||||
data[y][x][1] = clip(data[y][x][3]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method clips the values of a color so that it
|
|
||||||
* is in the range 0-255
|
|
||||||
* @param color
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int clip(int color){
|
|
||||||
if(color < 0)
|
|
||||||
return 0;
|
|
||||||
else if(color > 255)
|
|
||||||
return 255;
|
|
||||||
else
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The underlying effect is run here
|
* The underlying effect is run here
|
||||||
* @param data The raw image to apply the effect to
|
* @param data The raw image to apply the effect to
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,25 @@ public class ImageUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes the image data by the given scale
|
||||||
|
*
|
||||||
|
* @param output The output data array
|
||||||
|
* @param data The image data
|
||||||
|
* @param cols The number of columns
|
||||||
|
* @param rows The number of rows
|
||||||
|
* @param scale The scale to normalize the image by
|
||||||
|
*/
|
||||||
|
public static void normalize(int[][][] output, int[][][] data, int cols, int rows, double scale) {
|
||||||
|
for(int y=0; y<rows ;y++){
|
||||||
|
for(int x=0; x<cols ;x++){
|
||||||
|
output[y][x][1] = (int)(data[y][x][1] * scale);
|
||||||
|
output[y][x][2] = (int)(data[y][x][2] * scale);
|
||||||
|
output[y][x][3] = (int)(data[y][x][3] * scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the rms value of the image
|
* Returns the rms value of the image
|
||||||
|
|
@ -167,4 +186,60 @@ public class ImageUtil {
|
||||||
}
|
}
|
||||||
return crop;
|
return crop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the given array to a new one that it returns
|
||||||
|
*
|
||||||
|
* @param data The data to duplicate
|
||||||
|
* @param cols The amount of columns
|
||||||
|
* @param rows The amount of rows
|
||||||
|
* @return The array copy
|
||||||
|
*/
|
||||||
|
public static int[][][] copyArray(int[][][] data,int cols,int rows){
|
||||||
|
int[][][] copy = new int[rows][cols][4];
|
||||||
|
for(int y=0; y<rows ;y++){
|
||||||
|
for(int x=0; x<cols ;x++){
|
||||||
|
copy[y][x][0] = data[y][x][0];
|
||||||
|
copy[y][x][1] = data[y][x][1];
|
||||||
|
copy[y][x][2] = data[y][x][2];
|
||||||
|
copy[y][x][3] = data[y][x][3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method clips the values of the pixel so that they
|
||||||
|
* are in the range 0-255
|
||||||
|
*
|
||||||
|
* @param data The image data
|
||||||
|
* @param cols The amount of columns
|
||||||
|
* @param rows The amount of rows
|
||||||
|
*/
|
||||||
|
public static void clip(int[][][] data, int cols, int rows){
|
||||||
|
for(int y=0; y<rows ;y++){
|
||||||
|
for(int x=0; x<cols ;x++){
|
||||||
|
data[y][x][1] = clip(data[y][x][1]);
|
||||||
|
data[y][x][1] = clip(data[y][x][2]);
|
||||||
|
data[y][x][1] = clip(data[y][x][3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method clips the values of a color so that it
|
||||||
|
* is in the range 0-255
|
||||||
|
*
|
||||||
|
* @param color
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int clip(int color){
|
||||||
|
if(color < 0)
|
||||||
|
return 0;
|
||||||
|
else if(color > 255)
|
||||||
|
return 255;
|
||||||
|
else
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,52 +26,58 @@ public class BlurFilter extends ImageFilterProcessor{
|
||||||
super(img);
|
super(img);
|
||||||
blurValue = blur;
|
blurValue = blur;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[][][] process(final int[][][] data, int cols, int rows) {
|
public int[][][] process(final int[][][] data, int cols, int rows) {
|
||||||
int inputPeak = ImageUtil.peakValue(data, cols, rows);
|
int inputPeak = ImageUtil.peakValue(data, cols, rows);
|
||||||
|
|
||||||
int[][][] output = new int[rows][cols][4];
|
int[][][] output = new int[rows][cols][4];
|
||||||
//Perform the convolution one or more times
|
int[][][] tmpData = ImageUtil.copyArray(data, cols, rows);
|
||||||
// in succession
|
//Perform the convolution one or more times in succession
|
||||||
|
int redSum, greenSum, blueSum, outputPeak;
|
||||||
for(int i=0; i<blurValue ;i++){
|
for(int i=0; i<blurValue ;i++){
|
||||||
//Iterate on each pixel as a registration
|
//Iterate on each pixel as a registration point.
|
||||||
// point.
|
for(int y=0; y<rows ;y++){
|
||||||
for(int y=1; y<rows-2 ;y++){
|
setProgress(ZMath.percent(0, (blurValue-1)*(rows-2), i*(rows-2)+y));
|
||||||
setProgress(ZMath.percent(0, (blurValue-1)*(rows-3), i*(rows-3)+y));
|
for(int x=0; x<cols ;x++){
|
||||||
for(int x=0+1; x<cols-2 ;x++){
|
if(x == 0 || x == cols-1 || y == 0 || y == rows-1){
|
||||||
int redSum =
|
redSum = tmpData[y][x][1] * 9;
|
||||||
data[y - 1][x - 1][1] +
|
greenSum = tmpData[y][x][2] * 9;
|
||||||
data[y - 1][x - 0][1] +
|
blueSum = tmpData[y][x][3] * 9;
|
||||||
data[y - 1][x + 1][1] +
|
}
|
||||||
data[y - 0][x - 1][1] +
|
else{
|
||||||
data[y - 0][x - 0][1] +
|
redSum =
|
||||||
data[y - 0][x + 1][1] +
|
tmpData[y - 1][x - 1][1] +
|
||||||
data[y + 1][x - 1][1] +
|
tmpData[y - 1][x - 0][1] +
|
||||||
data[y + 1][x - 0][1] +
|
tmpData[y - 1][x + 1][1] +
|
||||||
data[y + 1][x + 1][1];
|
tmpData[y - 0][x - 1][1] +
|
||||||
int greenSum =
|
tmpData[y - 0][x - 0][1] +
|
||||||
data[y - 1][x - 1][2] +
|
tmpData[y - 0][x + 1][1] +
|
||||||
data[y - 1][x - 0][2] +
|
tmpData[y + 1][x - 1][1] +
|
||||||
data[y - 1][x + 1][2] +
|
tmpData[y + 1][x - 0][1] +
|
||||||
data[y - 0][x - 1][2] +
|
tmpData[y + 1][x + 1][1];
|
||||||
data[y - 0][x - 0][2] +
|
greenSum =
|
||||||
data[y - 0][x + 1][2] +
|
tmpData[y - 1][x - 1][2] +
|
||||||
data[y + 1][x - 1][2] +
|
tmpData[y - 1][x - 0][2] +
|
||||||
data[y + 1][x - 0][2] +
|
tmpData[y - 1][x + 1][2] +
|
||||||
data[y + 1][x + 1][2];
|
tmpData[y - 0][x - 1][2] +
|
||||||
int blueSum =
|
tmpData[y - 0][x - 0][2] +
|
||||||
data[y - 1][x - 1][3] +
|
tmpData[y - 0][x + 1][2] +
|
||||||
data[y - 1][x - 0][3] +
|
tmpData[y + 1][x - 1][2] +
|
||||||
data[y - 1][x + 1][3] +
|
tmpData[y + 1][x - 0][2] +
|
||||||
data[y - 0][x - 1][3] +
|
tmpData[y + 1][x + 1][2];
|
||||||
data[y - 0][x - 0][3] +
|
blueSum =
|
||||||
data[y - 0][x + 1][3] +
|
tmpData[y - 1][x - 1][3] +
|
||||||
data[y + 1][x - 1][3] +
|
tmpData[y - 1][x - 0][3] +
|
||||||
data[y + 1][x - 0][3] +
|
tmpData[y - 1][x + 1][3] +
|
||||||
data[y + 1][x + 1][3];
|
tmpData[y - 0][x - 1][3] +
|
||||||
|
tmpData[y - 0][x - 0][3] +
|
||||||
output[y][x][0] = data[y][x][0];
|
tmpData[y - 0][x + 1][3] +
|
||||||
|
tmpData[y + 1][x - 1][3] +
|
||||||
|
tmpData[y + 1][x - 0][3] +
|
||||||
|
tmpData[y + 1][x + 1][3];
|
||||||
|
}
|
||||||
|
output[y][x][0] = tmpData[y][x][0];
|
||||||
output[y][x][1] = redSum;
|
output[y][x][1] = redSum;
|
||||||
output[y][x][2] = greenSum;
|
output[y][x][2] = greenSum;
|
||||||
output[y][x][3] = blueSum;
|
output[y][x][3] = blueSum;
|
||||||
|
|
@ -79,10 +85,10 @@ public class BlurFilter extends ImageFilterProcessor{
|
||||||
}
|
}
|
||||||
|
|
||||||
// getting the new peak value and normalizing the image
|
// getting the new peak value and normalizing the image
|
||||||
int outputPeak = ImageUtil.peakValue(output, cols, rows);
|
outputPeak = ImageUtil.peakValue(output, cols, rows);
|
||||||
ImageUtil.normalize(output, cols, rows, ((double)inputPeak)/outputPeak );
|
ImageUtil.normalize(tmpData, output, cols, rows, ((double)inputPeak)/outputPeak );
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return tmpData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,13 @@ public class ContrastBrightnessFilter extends ImageFilterProcessor{
|
||||||
public int[][][] process(final int[][][] data, int cols, int rows) {
|
public int[][][] process(final int[][][] data, int cols, int rows) {
|
||||||
int mean = ImageUtil.meanValue(data, cols, rows);
|
int mean = ImageUtil.meanValue(data, cols, rows);
|
||||||
|
|
||||||
int[][][] output = copyArray(data, cols, rows);
|
int[][][] output = ImageUtil.copyArray(data, cols, rows);
|
||||||
|
|
||||||
ImageUtil.addMeanValue(output, cols, rows, mean*(-1));
|
ImageUtil.addMeanValue(output, cols, rows, mean*(-1));
|
||||||
ImageUtil.scale(output, cols, rows, contrast);
|
ImageUtil.scale(output, cols, rows, contrast);
|
||||||
ImageUtil.addMeanValue(output, cols, rows, (int)(brightness*mean));
|
ImageUtil.addMeanValue(output, cols, rows, (int)(brightness*mean));
|
||||||
|
|
||||||
clip(output , cols, rows);
|
ImageUtil.clip(output ,cols, rows);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package zutil.image.filters;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
import zutil.image.ImageFilterProcessor;
|
import zutil.image.ImageFilterProcessor;
|
||||||
|
import zutil.image.ImageUtil;
|
||||||
import zutil.math.ZMath;
|
import zutil.math.ZMath;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -41,7 +42,7 @@ public class DitheringFilter extends ImageFilterProcessor{
|
||||||
int error, index;
|
int error, index;
|
||||||
int[] currentPixel;
|
int[] currentPixel;
|
||||||
|
|
||||||
int[][][] output = copyArray(data, cols, rows);
|
int[][][] output = ImageUtil.copyArray(data, cols, rows);
|
||||||
|
|
||||||
for(int y=0; y<rows ;y++){
|
for(int y=0; y<rows ;y++){
|
||||||
setProgress(ZMath.percent(0, rows-1, y));
|
setProgress(ZMath.percent(0, rows-1, y));
|
||||||
|
|
@ -53,14 +54,14 @@ public class DitheringFilter extends ImageFilterProcessor{
|
||||||
for (int i = 1; i < 4; i++) {
|
for (int i = 1; i < 4; i++) {
|
||||||
error = currentPixel[i] - palette[index][i];
|
error = currentPixel[i] - palette[index][i];
|
||||||
if (x + 1 < cols) {
|
if (x + 1 < cols) {
|
||||||
output[y+0][x+1][i] = clip( output[y+0][x+1][i] + (error*7)/16 );
|
output[y+0][x+1][i] = ImageUtil.clip( output[y+0][x+1][i] + (error*7)/16 );
|
||||||
}
|
}
|
||||||
if (y + 1 < rows) {
|
if (y + 1 < rows) {
|
||||||
if (x - 1 > 0)
|
if (x - 1 > 0)
|
||||||
output[y+1][x-1][i] = clip( output[y+1][x-1][i] + (error*3)/16 );
|
output[y+1][x-1][i] = ImageUtil.clip( output[y+1][x-1][i] + (error*3)/16 );
|
||||||
output[y+1][x+0][i] = clip( output[y+1][x+0][i] + (error*5)/16 );
|
output[y+1][x+0][i] = ImageUtil.clip( output[y+1][x+0][i] + (error*5)/16 );
|
||||||
if (x + 1 < cols)
|
if (x + 1 < cols)
|
||||||
output[y+1][x+1][i] = clip( output[y+1][x+1][i] + (error*1)/16 );
|
output[y+1][x+1][i] = ImageUtil.clip( output[y+1][x+1][i] + (error*1)/16 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package zutil.image.filters;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
import zutil.image.ImageFilterProcessor;
|
import zutil.image.ImageFilterProcessor;
|
||||||
|
import zutil.image.ImageUtil;
|
||||||
import zutil.math.ZMath;
|
import zutil.math.ZMath;
|
||||||
|
|
||||||
public class SpotLightFilter extends ImageFilterProcessor{
|
public class SpotLightFilter extends ImageFilterProcessor{
|
||||||
|
|
@ -62,9 +63,9 @@ public class SpotLightFilter extends ImageFilterProcessor{
|
||||||
}
|
}
|
||||||
|
|
||||||
output[y][x][0] = data[y][x][0];
|
output[y][x][0] = data[y][x][0];
|
||||||
output[y][x][1] = clip((int)(scale * data[y][x][1]));
|
output[y][x][1] = ImageUtil.clip((int)(scale * data[y][x][1]));
|
||||||
output[y][x][2] = clip((int)(scale * data[y][x][2]));
|
output[y][x][2] = ImageUtil.clip((int)(scale * data[y][x][2]));
|
||||||
output[y][x][3] = clip((int)(scale * data[y][x][3]));
|
output[y][x][3] = ImageUtil.clip((int)(scale * data[y][x][3]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import zutil.image.filters.SpotLightFilter;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class ImageProcessorTest implements ProgressListener{
|
public class ImageProcessorTest implements ProgressListener{
|
||||||
private static String imgPath = "Image6.gif";
|
private static String imgPath = "exemple.gif";
|
||||||
|
|
||||||
private JLabel processedLabel;
|
private JLabel processedLabel;
|
||||||
private JLabel orginalLabel;
|
private JLabel orginalLabel;
|
||||||
|
|
@ -64,11 +64,11 @@ public class ImageProcessorTest implements ProgressListener{
|
||||||
//ImageFilterProcessor processor = new SpotLightFilter(img,100,100,100);
|
//ImageFilterProcessor processor = new SpotLightFilter(img,100,100,100);
|
||||||
//ImageFilterProcessor processor = new ContrastBrightnessFilter(img);
|
//ImageFilterProcessor processor = new ContrastBrightnessFilter(img);
|
||||||
//ImageFilterProcessor processor = new ColorIntensityFilter(img, true);
|
//ImageFilterProcessor processor = new ColorIntensityFilter(img, true);
|
||||||
//ImageFilterProcessor processor = new BlurFilter(img);
|
ImageFilterProcessor processor = new BlurFilter(img, 100);
|
||||||
//ImageFilterProcessor processor = new DitheringFilter(img);
|
//ImageFilterProcessor processor = new DitheringFilter(img);
|
||||||
//ImageFilterProcessor processor = new ResizeImage(img,100,100);
|
//ImageFilterProcessor processor = new ResizeImage(img,100,100);
|
||||||
//ImageFilterProcessor processor = new MedianFilter(img);
|
//ImageFilterProcessor processor = new MedianFilter(img);
|
||||||
ImageFilterProcessor processor = new FaceDetectionFilter(img);
|
//ImageFilterProcessor processor = new FaceDetectionFilter(img);
|
||||||
|
|
||||||
processor.setProgressListener(this);
|
processor.setProgressListener(this);
|
||||||
procImg = processor.process();
|
procImg = processor.process();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue