Foros del Web » Programando para Internet » Python »

ejercicos

Estas en el tema de ejercicos en el foro de Python en Foros del Web. Hola a todos!! Casualmente me han enredado para que hiciera unos ejercicios (yo no sabia que eran con phyton) el caso es que no conozco ...
  #1 (permalink)  
Antiguo 20/04/2009, 11:12
 
Fecha de Ingreso: abril-2009
Mensajes: 2
Antigüedad: 15 años
Puntos: 0
ejercicos

Hola a todos!!
Casualmente me han enredado para que hiciera unos ejercicios (yo no sabia que eran con phyton) el caso es que no conozco el lenguaje y no los se hacer confio en que alguien me heche una mano!!!

Muchisimas gracias!!!!

os copio los ejercicios:

Exercise 2.2 Write a script that computes the runlength histogram of an image of your choice and writes it into a control file runs.dat for the plotting program gnuplot5. The control files must have the following form:
set xrange [0:30] # optional for setting xrange
plot ’-’ with impulses title ’black horizontal runs’
0 0
1 40
...
e
where the first column is the runlength and the second its frequency. You can then display the plot with gnuplot -persist runs.dat. Hints:
• Have a look at the method runlength histogram in the plugin reference. The parameters are
passed as strings.
• To iterate simultaneously over an index and its list value, you can use the Python iterator enumerate [2].
Extend your script such that it accepts command line parameters determining whether black/white or horizontal/vertical runs shall be counted (look for the argv variable in [2]).


Exercise 2.3 Write a script that measures the most frequent black vertical runlength of an image and creates an RGB image with all black vertical runs of the most frequent runlength marked in red.
Hints: You must try to create an image that only contains the runlengths that are to be marked, so that you can use highlight to mark them. All black vertical runlengths of length n are obtained by subtracting all runlengths smaller than n (filter tall runs) and all runlegths greater than n (filter short runs). Beware that these methods work in place on the image. This means that you must copy the image beforehand (image copy).
Apply your script to a music score. What do you observe?

Exercise 2.4 Do a cc analysis on an image and list all used labels in sorted order. Are the labels consecutive or are there gaps?
Hint: You can read out all labels elegantly via a Python “list comprehension” [2]:
labels = [c.label for c in ccs]
Exercise 3.1 Write a C++ plugin that flips every second white pixel of a onebit image to black.
• Call the plugin flip1 and let it change the input image.
• Call the plugin flip2 and let it return the resulting image.


Exercise 3.2 Write two variants of the plugin flip2 of the previous exercise that both access the individual pixels with get(Point(x,y)) and set in a loop over x and and y. One variant shall have the x-loop outside and one the y-loop.
Show by measuring the runtimes of both variants that it is always better in Gamera to have the outer loop vary over y and the inner loop over x. You can measure the runtime as follows:
import time
t = time.time()
res = img.flip2()
t = time.time() - t
print ("Runtime: %f" % t)

Exercise 3.3 Write a C++ plugin that replaces the pixel value at position (x, y) with the average over positions x − 1 to x + 1. In other words, an image f(x, y) shall be transformed to


The result shall be returned as a greyscale image. Find a solution for the problem that the values for white and black are exchanged in onebit and greyscale images. Hints:
• The solution consists either in the use of template specialization or a (slightly) tricky utilization of the functions black and white.
• Use NumericTraits for computing the average.
• Make sure that the sum does not go beyond the image borders.Why is it better to take care of the borders in the range of the for-loops rather than doing a range check inside the for-loops?

Exercise 4.1 Write on a sheet of paper 20 instances of one character (e.g. “a”), and on a second paper 20 instances of a different character (e.g. “b”). Make sure that all characters are a single CC (for easy segmentation with cc analysis) and scan both pages to a raster image. Plot the distribution of all of your symbols in a two dimensional feature space as follows:
• segment both images into CCs with cc analysis
• read for each CC two feature values of your choice, e.g.
feature1 = c.aspect ratio()[0]
feature2 = c.moments()[2]
• write a Gnuplot control file plot.dat of the form plot ’-’ with points title ’a’, ’-’ with points title ’b’
# feature values class a
0.7692 0.1315
...
e
# feature values class b
1.3421 2.9872
...
e
• display the plot with the command gnuplot -persist plot.dat


Exercise 4.2 Use the two images from the preceding exercise to create a training dataset containing five from each of your two characters. Write a script that uses this training dataset to recognize all characters from both images with a kNNInteractive classifier.
Try different sets of features and values of k and measure the recognition rates for both characters (recogniton rate = number of correctly classified symbols divided by the total number of symbols).
  #2 (permalink)  
Antiguo 20/04/2009, 19:24
Avatar de dmassive  
Fecha de Ingreso: febrero-2002
Ubicación: Paraná - Entre Ríos - Argentina
Mensajes: 279
Antigüedad: 22 años, 2 meses
Puntos: 7
Sonrisa Respuesta: ejercicos

Lo lei asi nomas, pero se ve bastante complejo para ser actividades de principiante y se parece la base para armar un bot para romper los kaptcha. Pero dice que hay que hacer cosas en C y tambien hay nombre de ¿componentes??... quizas te convendria ser mas especifico sobre lo que necesitas.
__________________
Blümchen... einfach die rave Prinzessin
http://www.dmassive.com.ar/
  #3 (permalink)  
Antiguo 21/04/2009, 01:22
venkman
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: ejercicos

¿Cuánto pagas?
  #4 (permalink)  
Antiguo 21/04/2009, 04:15
 
Fecha de Ingreso: abril-2009
Mensajes: 2
Antigüedad: 15 años
Puntos: 0
Respuesta: ejercicos

Hola
La verdad esk me adjuntaron un pequeño tutorial con los ejercicios pero ni aún asi lo se hacer (mis conocimentos de programcion són bastante limitados). os adjunto la web donde esta colgado el tutorial con los ejercicios, pero solo hace falta que resuelva los ejercicios a partir del 2.2
Yo no se que es "armar un bot para romper los kaptcha" pero me dijeron que era un pequeño tutorial para empezar a trabajar con el reconocimiento de imagenes

htp://gamera.informatik.hsnr.de/docs/gamera-tutorial.pdf
Gracias!!!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:59.