update noisepictures
This commit is contained in:
parent
c2648077f2
commit
920a864b22
|
@ -21,7 +21,8 @@ trigofest: trigofest.f90 Makefile vue3axes.o utils_ga.o
|
||||||
utils_ga.o -o $@
|
utils_ga.o -o $@
|
||||||
|
|
||||||
noisepic: noisepic.f90 Makefile
|
noisepic: noisepic.f90 Makefile
|
||||||
gfortran $(GFOPT) $< ../Modules/spitpgm.o ../Modules/pixrgb.o \
|
gfortran $(GFOPT) $< ../Modules/spitpgm.o ../Modules/pixrgb.o \
|
||||||
|
../Modules/noisepictures.o \
|
||||||
-o $@
|
-o $@
|
||||||
|
|
||||||
# ---- modules locaux
|
# ---- modules locaux
|
||||||
|
|
|
@ -2,6 +2,7 @@ program noisepic
|
||||||
|
|
||||||
use spitpgm
|
use spitpgm
|
||||||
use pixrgb
|
use pixrgb
|
||||||
|
use noisepictures
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer :: numframe = 0
|
integer :: numframe = 0
|
||||||
|
@ -17,11 +18,11 @@ program noisepic
|
||||||
read (arg, *) numframe
|
read (arg, *) numframe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ranges(0) = 10 ; ranges(2) = 90
|
ranges(1) = 10 ; ranges(2) = 90
|
||||||
ranges(3) = 110 ; ranges(4) = 166
|
ranges(3) = 110 ; ranges(4) = 166
|
||||||
ranges(5) = 205 ; ranges(6) = 230
|
ranges(5) = 205 ; ranges(6) = 230
|
||||||
nbre = 1000+(numframe*555)
|
nbre = 1000+(numframe*555)
|
||||||
call make_noise_color_range_pic(numframe, ranges, nbre)
|
call make_noise_bw_pic (numframe)
|
||||||
|
|
||||||
contains
|
contains
|
||||||
!-- ------------------------------------------------------------------
|
!-- ------------------------------------------------------------------
|
||||||
|
@ -44,33 +45,13 @@ subroutine make_noise_bw_pic (value)
|
||||||
foo = irand()
|
foo = irand()
|
||||||
print *, 'val=', value, ' rnd=', foo
|
print *, 'val=', value, ' rnd=', foo
|
||||||
|
|
||||||
call plot_noise_bw_pic(pic, 15000)
|
! call plot_noise_bw_pic(pic, 15000)
|
||||||
|
call noise_gray8_pic(pic, 15000)
|
||||||
|
|
||||||
write (filename, "(a, i5.5, a)") "", value, ".pgm"
|
write (filename, "(a, i5.5, a)") "", value, ".pgm"
|
||||||
call spit_as_pgm_8(pic, trim(filename))
|
call spit_as_pgm_8(pic, trim(filename))
|
||||||
end subroutine
|
end subroutine
|
||||||
!-- ------------------------------------------------------------------
|
!-- ------------------------------------------------------------------
|
||||||
subroutine plot_noise_bw_pic(picz, nbre)
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
integer, dimension(:,:), intent(inout) :: picz
|
|
||||||
integer, intent(in) :: nbre
|
|
||||||
|
|
||||||
integer :: width, height
|
|
||||||
integer :: quux, ix, iy, iv
|
|
||||||
|
|
||||||
width = ubound(picz, 1) ; height = ubound(picz, 2)
|
|
||||||
! print *, 'sz picz', width, height
|
|
||||||
|
|
||||||
do quux=1, nbre
|
|
||||||
ix = 1 + mod ( irand(), width )
|
|
||||||
iy = 1 + mod ( irand(), height )
|
|
||||||
iv = mod ( irand(), 256 )
|
|
||||||
! print *, ix, iy
|
|
||||||
picz(ix, iy) = iv
|
|
||||||
enddo
|
|
||||||
end subroutine
|
|
||||||
|
|
||||||
!-- ------------------------------------------------------------------
|
!-- ------------------------------------------------------------------
|
||||||
!-
|
!-
|
||||||
!- Colorized
|
!- Colorized
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
module noisepictures
|
||||||
|
use pixrgb
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
contains ! a lot of garbage ?
|
||||||
|
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
subroutine noise_gray8_pic(pict, nbre)
|
||||||
|
implicit none
|
||||||
|
integer, dimension(:,:), intent(inout) :: pict
|
||||||
|
integer, intent(in) :: nbre
|
||||||
|
integer :: quux, ix, iy, width, height
|
||||||
|
|
||||||
|
width = ubound(pict, 1) ; height = ubound(pict, 2)
|
||||||
|
|
||||||
|
do quux=1, nbre
|
||||||
|
ix = 1 + mod ( irand(), width )
|
||||||
|
iy = 1 + mod ( irand(), height )
|
||||||
|
pict(ix, iy) = mod ( irand(), 256 )
|
||||||
|
enddo
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
subroutine noise_gray16_pic(pict, nbre)
|
||||||
|
implicit none
|
||||||
|
integer, dimension(:,:), intent(inout) :: pict
|
||||||
|
integer, intent(in) :: nbre
|
||||||
|
integer :: quux, ix, iy, width, height
|
||||||
|
|
||||||
|
width = ubound(pict, 1) ; height = ubound(pict, 2)
|
||||||
|
|
||||||
|
do quux=1, nbre
|
||||||
|
ix = 1 + mod ( irand(), width )
|
||||||
|
iy = 1 + mod ( irand(), height )
|
||||||
|
pict(ix, iy) = mod ( irand(), 65536 )
|
||||||
|
enddo
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
subroutine noise_rgb8_pic(prgb, nbre)
|
||||||
|
implicit none
|
||||||
|
type(t_pixrgb), dimension(:,:), intent(inout) :: prgb
|
||||||
|
integer, intent(in) :: nbre
|
||||||
|
integer :: quux, ix, iy, width, height
|
||||||
|
|
||||||
|
print *, 'noise_rgb_pic', nbre
|
||||||
|
|
||||||
|
width = ubound(prgb, 1) ; height = ubound(prgb, 2)
|
||||||
|
|
||||||
|
do quux=1, nbre
|
||||||
|
ix = 1 + mod ( irand(), width )
|
||||||
|
iy = 1 + mod ( irand(), height )
|
||||||
|
prgb(ix, iy)%r = mod ( irand(), 256 )
|
||||||
|
prgb(ix, iy)%g = mod ( irand(), 256 )
|
||||||
|
prgb(ix, iy)%b = mod ( irand(), 256 )
|
||||||
|
enddo
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
subroutine noise_rgb16_pic(prgb, nbre)
|
||||||
|
implicit none
|
||||||
|
type(t_pixrgb), dimension(:,:), intent(inout) :: prgb
|
||||||
|
integer, intent(in) :: nbre
|
||||||
|
integer :: quux, ix, iy, width, height
|
||||||
|
|
||||||
|
print *, 'noise_rgb_pic', nbre
|
||||||
|
|
||||||
|
width = ubound(prgb, 1) ; height = ubound(prgb, 2)
|
||||||
|
|
||||||
|
do quux=1, nbre
|
||||||
|
ix = 1 + mod ( irand(), width )
|
||||||
|
iy = 1 + mod ( irand(), height )
|
||||||
|
prgb(ix, iy)%r = mod ( irand(), 65536 )
|
||||||
|
prgb(ix, iy)%g = mod ( irand(), 65536 )
|
||||||
|
prgb(ix, iy)%b = mod ( irand(), 65536 )
|
||||||
|
enddo
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
end module noisepictures
|
|
@ -1,21 +1,66 @@
|
||||||
program essai
|
program essai
|
||||||
|
|
||||||
use mathstuff2
|
use mathstuff2
|
||||||
|
use pixrgb
|
||||||
|
use spitpgm
|
||||||
|
use noisepictures
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer :: foo, bar
|
integer :: foo, bar
|
||||||
real :: quux
|
|
||||||
double precision :: somme
|
|
||||||
|
|
||||||
write(0, *) "----------------- essai -------------------"
|
write(0, *) "----------------- essai -------------------"
|
||||||
|
|
||||||
call init_random_seed() ! in module 'mathstuff'
|
call init_random_seed() ! in module 'mathstuff'
|
||||||
somme = 0.0
|
call test_noisepictures_rgb()
|
||||||
do foo=1, 500
|
call test_noisepictures_gray()
|
||||||
quux = rand() + rand()
|
|
||||||
somme = somme + quux
|
contains
|
||||||
bar = mod(irand(), 7)
|
!-----------------------------------------------------------------------
|
||||||
print *, foo, quux, somme/foo, bar
|
|
||||||
enddo
|
subroutine test_noisepictures_rgb ()
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
type(t_pixrgb), allocatable :: pix (:,:)
|
||||||
|
integer :: nombre
|
||||||
|
print *, '------ test des noisepictures RGB'
|
||||||
|
|
||||||
|
allocate(pix(800, 600))
|
||||||
|
nombre = (800*600)/4
|
||||||
|
|
||||||
|
call rgbpix_set_to_rgb(pix, 0, 0, 0)
|
||||||
|
call noise_rgb8_pic(pix, nombre)
|
||||||
|
call rgbpix_spit_as_pnm_8(pix, 'foo8.pnm')
|
||||||
|
|
||||||
|
call rgbpix_set_to_rgb(pix, 0, 0, 0)
|
||||||
|
call noise_rgb16_pic(pix, nombre)
|
||||||
|
call rgbpix_spit_as_pnm_16(pix, 'foo16.pnm')
|
||||||
|
|
||||||
|
deallocate (pix)
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
subroutine test_noisepictures_gray ()
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
integer, allocatable :: pix (:,:)
|
||||||
|
integer :: nombre
|
||||||
|
print *, '------ test des noisepictures GRAY'
|
||||||
|
|
||||||
|
allocate(pix(800, 600))
|
||||||
|
nombre = (800*600)/4
|
||||||
|
|
||||||
|
pix = 0
|
||||||
|
call noise_gray8_pic(pix, nombre)
|
||||||
|
call spit_as_pgm_8(pix, 'bar8.pgm')
|
||||||
|
|
||||||
|
pix = 0
|
||||||
|
call noise_gray16_pic(pix, nombre)
|
||||||
|
call spit_as_pgm_16(pix, 'bar16.pgm')
|
||||||
|
|
||||||
|
deallocate (pix)
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
|
||||||
end program
|
end program
|
||||||
|
|
Loading…
Reference in New Issue