I am looking to improve the contrast and resolution of an image? Could someone help me
THanks
Image contrast and resolution
-
- Enthusiast
- Posts: 542
- Joined: Tue Oct 14, 2014 12:09 pm
Re: Image contrast and resolution
Hi
For Contrast you just have to search for it in the forums, you will find it.
Simple as sample so an Google : "purebasic image contrast"
You can't increase the resolution, because you can't make something new out of something that doesn't exist.
Only AI can do this, but then it is always only additions that are not based on real data, because they do not exist.
With ResizeImage you can trigger an interpolation of the image.
It will be smoother, but primarily image information will be lost again.
https://topten.ai/image-upscalers-review/
For Contrast you just have to search for it in the forums, you will find it.
Simple as sample so an Google : "purebasic image contrast"
You can't increase the resolution, because you can't make something new out of something that doesn't exist.
Only AI can do this, but then it is always only additions that are not based on real data, because they do not exist.
With ResizeImage you can trigger an interpolation of the image.
It will be smoother, but primarily image information will be lost again.
https://topten.ai/image-upscalers-review/
Last edited by Saki on Fri Nov 06, 2020 12:26 pm, edited 1 time in total.
地球上の平和
-
- Enthusiast
- Posts: 542
- Joined: Tue Oct 14, 2014 12:09 pm
Re: Image contrast and resolution
I found a program on forum
But i have a problem
How to retrieve an image staying in memory
THanks
But i have a problem
How to retrieve an image staying in memory
Code: Select all
CopyMemory(GetRawImagePixelsPtr(*RawImage), DrawingBuffer(), ImageWidth(Image) * ImageHeight(Image) * 3 )
Re: Image contrast and resolution
A really good image enhancement is only possible with AI, you won't find it in the PB forums.
I think you mean CatchImage()
I think you mean CatchImage()
地球上の平和
Re: Image contrast and resolution
Hi
Image contrast
Image contrast
Code: Select all
UseJPEGImageDecoder()
UseJPEG2000ImageDecoder()
UsePNGImageDecoder()
UseTIFFImageDecoder()
UseTGAImageDecoder()
UseGIFImageDecoder()
Procedure.i iColorLimit(val.i)
EnableASM
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
MOV eax, val
!test eax, -256
!cmovg eax, [cLimit255]
!cmovs eax, [cLimit0]
CompilerElse
MOV rax, val
!test rax, -256
!cmovg rax, [cLimit255]
!cmovs rax, [cLimit0]
CompilerEndIf
DisableASM
ProcedureReturn
!cLimit255:
!dd 255
!cLimit0:
!dd 0, 0
EndProcedure
Procedure.i iScale(val1.i, val2.i, perc.f)
EnableASM
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
!cvtsi2sd xmm0, [p.v_val1]
!cvtsi2sd xmm1, [p.v_val2]
!cvtss2sd xmm2, [p.v_perc]
!movq xmm3, xmm0
!mulsd xmm0, xmm2
!mulsd xmm1, xmm2
!subsd xmm3, xmm0
!addsd xmm1, xmm3
!cvtsd2si eax, xmm1
CompilerElse
MOV rax, val1
!cvtsi2sd xmm0, rax
MOV rax, val2
!cvtsi2sd xmm1, rax
!cvtss2sd xmm2, [p.v_perc]
!movq xmm3, xmm0
!mulsd xmm0, xmm2
!mulsd xmm1, xmm2
!subsd xmm3, xmm0
!addsd xmm1, xmm3
!cvtsd2si rax, xmm1
CompilerEndIf
DisableASM
ProcedureReturn
EndProcedure
Procedure.l Contrast( Scale.f)
CopyImage(0,1)
StartDrawing(ImageOutput(1))
For x = 0 To ImageWidth(1)-1
For y = 0 To ImageHeight(1)-1
color = Point(x,y)
Red.l = (Color & $FF) * Scale + 127 * (1 - Scale)
Green.l = (Color >> 8 & $FF) * Scale + 127 * (1 - Scale)
Blue.l = (Color >> 16 & $FF) * Scale + 127 * (1 - Scale)
iColorLimit(Red)
iColorLimit(Green)
iColorLimit(Blue)
ncolor = (((Blue << 8 + Green) << 8) + Red)
Plot(x,y, ncolor)
Next
Next
StopDrawing()
SetGadgetAttribute(0,#PB_Button_Image,ImageID(1))
EndProcedure
Pattern$ = "All supported formats|*.*;*.bmp; *.gif; *.jpg; *.jpeg; *.png;*.tif;*.tiff;*.tga|TGA image (*.tga)|*.tga|"+
"TIF image (*.tif)|*.tif|TIFF image (*.tiff)|*.tiff|PNG image (*.png)|*.png|BMP image (*.bmp)|*.bmp|"+
"JPEG image (*.jpg;*.jpeg)|*.jpg;*.jpeg|GIF image (*.gif)|*.gif|"
OpenWindow(0,0,0,800,600,"test",#PB_Window_SystemMenu |#PB_Window_ScreenCentered)
cont = ContainerGadget(#PB_Any,10,10,780,540,#PB_Container_Flat)
ButtonImageGadget(0,-1,-1,780,540,0,#PB_Image_Border)
CloseGadgetList()
DisableGadget(cont,1)
ButtonGadget(1,10,560,60,30,"Open")
TrackBarGadget(2,80,560 ,680,30,0,100)
SetGadgetState(2,100)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 1
File$ = OpenFileRequester("Choose image file to load", "*.*", Pattern$, 0)
If File$ And FileSize(File$)
LoadImage(0,File$)
SetGadgetAttribute(0,#PB_Button_Image,ImageID(0))
EndIf
Case 2
percent.f = GetGadgetState(2)/100
Contrast(percent.f)
EndSelect
EndSelect
Until Quit = 1
Egypt my love