SystemError:新样式的getargs格式,但参数不是元组

时间:2016-10-26 19:37:42

标签: python-2.7 image-processing fingerprint

我尝试在github上使用一段代码,整个项目https://github.com/rtshadow/biometrics 我用了

python thining.py image.gif --save

但它有一个错误:

Traceback (most recent call last):
File "thining.py", line 77, in <module>
make_thin(im)
File "thining.py", line 59, in make_thin
utils.load_pixels(im, loaded)
File "---/Github/biometrics/utils.py", line 111, in load_pixels
im_load[i, j] = pixels[i][j]
SystemError: new style getargs format but argument is not a tuple

utiles.py的相应部分在这里:

 def load_pixels(im, pixels):
  (x, y) = im.size
  im_load = im.load()

  for i in range(0, x):
      for j in range(0, y):
          im_load[i, j] = pixels[i][j] // line 111

我不知道如何解决它。谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

检查您的Python版本:module LED_breath (led, tmr_clk); output reg led; input tmr_clk; reg [7:0] cnt; reg [6:0] pwm_cnt; reg [6:0] pwm_val; reg [2:0] pat_cnt; reg [9:0] delay_cnt; reg [6:0] cur_pat; reg [6:0] nxt_pat; parameter pattern = {7'h00, 7'h00, 7'h00, 7'h00, 7'h00, 7'h00, 7'h00, 7'h00}; always @(posedge tmr_clk) begin pwm_cnt = cnt[7] ? ~cnt[6:0] : cnt[6:0]; //Generate triangle wave if(pwm_cnt > pwm_val) //Generate pwm led <= 1'b0; if(pwm_cnt < pwm_val) led <= 1'b1; cnt = cnt + 1; end always @(posedge tmr_clk) //breathing pattern begin if(!delay_cnt) //Add delay begin cur_pat <= ((pattern >> (7*pat_cnt)) & 7'b1111111); //Find correct pattern No. from parameter list if((pat_cnt+1) == 8) //Check for last pattern - overflow, set to 0 nxt_pat <= (pattern & 7'b1111111); else nxt_pat <= ((pattern >> (7*(pat_cnt+1))) & 7'b1111111); if(pwm_val == nxt_pat) //If pwm is at max or min increment count to get next pattern pat_cnt <= pat_cnt + 1; if(cur_pat <= nxt_pat) //Current pattern < next pattern, count up pwm_val <= pwm_val + 1; if(cur_pat >= nxt_pat) //Current pattern < next pattern, count down pwm_val <= pwm_val - 1; end delay_cnt <= delay_cnt + 1; end endmodule module top (led_0, led_1, led_2, led_3); output led_0; output led_1; output led_2; output led_3; defparam I1.TIMER_DIV = "128"; OSCTIMER I1 (.DYNOSCDIS(1'b0), .TIMERRES(1'b0), .OSCOUT(osc_clk), .TIMEROUT(tmr_clk)); LED_breath #(.pattern({7'h20, 7'h70, 7'h50, 7'h70, 7'h40, 7'h10, 7'h60, 7'h10})) led_A( .led (led_0), .tmr_clk (tmr_clk) ); LED_breath #(.pattern({7'h70, 7'h10, 7'h30, 7'h20, 7'h60, 7'h40, 7'h70, 7'h10})) led_B( .led (led_1), .tmr_clk (tmr_clk) ); LED_breath #(.pattern({7'h10, 7'h30, 7'h10, 7'h18, 7'h40, 7'h50, 7'h30, 7'h60})) led_C( .led (led_2), .tmr_clk (tmr_clk) ); LED_breath #(.pattern({7'h50, 7'h70, 7'h40, 7'h50, 7'h40, 7'h70, 7'h60, 7'h70})) led_D( .led (led_3), .tmr_clk (tmr_clk) ); endmodule 。它似乎适用于2.7.6,但不是2.7.10。 (见原帖的评论。)