小编Rag*_*san的帖子

将数组转换为图像

我有一个名为C在其索引中包含像素的二维数组。如何查看该像素值构成的图像,图像可以用数组来表示。没有尝试相反的过程,我只想看到灰度图像,因为名为的数组C每个索引只有一个值。使用 python 进行编程

这是我的代码 http://pastebin.com/qmnKrtzu

在这一行中出现错误

ime = Image.fromarray(c)
ime.save("your_file.jpeg")
Run Code Online (Sandbox Code Playgroud)

ime = Image.fromarray(c_array) arr = obj.__array_interface__ AttributeError: 'list' object has no attribute '__array_interface__'

python opencv

7
推荐指数
1
解决办法
3万
查看次数

用函数表示c ++中的引用

任何人都可以请详细说明此代码中的引用行为,为什么它在第一行而不是11行打印12.

下面是代码

http://ideone.com/l9qaBp

#include <cstdio>
using namespace std;

int &fun()
{
    static int x = 10;
    x++;
    return x;
}

int main()
{
    int *ptr=&fun();
    int *ptr1=&fun();
    printf("%p  %p \t %d  %d",(void*)ptr,(void*)ptr1,*ptr,*ptr1);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

代码的输出是

134519132 134519132 12 12

请解释为什么12在第一次通话时打印而不是11我知道在第二次通话时它应该打印12

c++ c++11

6
推荐指数
1
解决办法
211
查看次数

如何获取灰度图像,像素矩阵值在[0-255]范围内python

我是新手,我正在尝试访问灰度图像的像素值

这是我的代码

im = cv.LoadImage("new.bmp")
# displaying the matrix form of image
for i in range(im.height):
 for j in range(im.width):
    print im[i,j],

print "\n",i    
Run Code Online (Sandbox Code Playgroud)

我正在获取 RGB 每个像素值的输出,请参阅输出的快照

在此输入图像描述

python opencv

5
推荐指数
1
解决办法
2万
查看次数

jQuery 事件未在动态创建的元素上触发

这是我的问题.. 在此输入图像描述

/* 我正在使用ajax动态创建表*/

 $(".n").click(function(){
      var id= $(this).closest('tr').find('td.ide2').html();

         //for displaying the table
         $.ajax({
           type: 'POST',
           url: '<?php echo base_url(); ?>Admin/show', //We are going to make the request to the method "list_dropdown" in the match controller
           dataType:'json',
           data: {'id':id}, //POST parameter to be sent with the tournament id
           success: function(resp) { 

             for(var i=0;i<(resp.length);i++)
              {
                var row = $('<tr></tr>').appendTo($("#unique-list"));

                $('<td />',{text:resp[i]}).appendTo(row);
                $('<td class="off-del glyphicon glyphicon-minus"></td>').appendTo(row);  

             }//end for loop
            } //end success
            });  //end ajax




          $(".off-del").click(function(){
          alert('hello');
          var id= $(this).closest('tr').find($(":first-child")).html();
          console.log(id);
          });
        });
Run Code Online (Sandbox Code Playgroud)

单击的事件 …

javascript ajax jquery

3
推荐指数
1
解决办法
1779
查看次数

如何在bootstrap模式关闭时触发事件

假设我有一个模态例如 在此输入图像描述

我希望在关闭此模态时触发事件.当我们点击关闭按钮或关闭按钮外的任何地方时,模型会关闭

    <a href='#part-3' data-toggle='modal' id='sss' style='float:right; color:black;' >view</a></center>

 //code for modal

  <div class="modal modal-wide fade" id="part-3" >
<div class="modal-dialog" style="min-width:60%">
  <div class="modal-content" >
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" >&times;</button>

    </div>
    <div class="modal-body">
        <div class="show">
           //the html code of form which is popped up
        </div>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我可以通过关闭按钮来关闭模式时轻松创建一个jquery事件,给它一个id,但是当用户点击模态外的任何地方时,如何触发/应该是该触发器的名称.

jquery twitter-bootstrap

3
推荐指数
1
解决办法
4367
查看次数

标签 统计

jquery ×2

opencv ×2

python ×2

ajax ×1

c++ ×1

c++11 ×1

javascript ×1

twitter-bootstrap ×1