图片观看显示无效图片

时间:2016-12-11 16:39:03

标签: c++ image-processing visual-studio-2015

我在这里的extensibilty部分尝试了第一个例子: http://research.microsoft.com/en-us/um/redmond/groups/ivm/imagewatchhelp/imagewatchhelp.htm#_Toc351981452

这是我的代码:

#include <memory>
struct My8BitRGBImage
{
    unsigned int ncols;
    unsigned int nrows;
    unsigned char* data;
};

void main()
{
    unsigned int ncols = 100;
    unsigned int nrows = 100;
    unsigned int bufferSize = ncols * nrows * 3;
    unsigned char * data = new unsigned char[bufferSize];
    memset(data, 0, bufferSize);
    My8BitRGBImage image = { ncols, nrows, data };
}

当我在最后一行打破并尝试观看图像时,我无效: Image

在ImageWatch.log中,似乎正确注册了My8BitRGBImage:

+ Parsing ImageWatchFrameBuffer.natvis ...
+ Found type My8BitRGBImage ...
+ -> Registering My8BitRGBImage

ImageWatchFrameBuffer.nativs看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">

  <UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1"
                MenuName="Add to Image Watch"/>

  <Type Name="My8BitRGBImage">
    <UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" />
  </Type>

  <Type Name="My8BitRGBImage">
    <Expand>
      <Synthetic Name="[type]">
        <DisplayString>UINT8</DisplayString>
      </Synthetic>
      <Synthetic Name="[channels]">
        <DisplayString>RGB</DisplayString>
      </Synthetic>
      <Item Name="[width]">ncols</Item>
      <Item Name="[height]">nrows</Item>
      <Item Name="[data]">data</Item>
      <Item Name="[stride]">ncols*3</Item>
    </Expand>
  </Type>  

</AutoVisualizer>

从示例中复制粘贴。 我正在使用VS2015更新1。 可能是什么问题?

2 个答案:

答案 0 :(得分:0)

使用

<Item Name="[channels]">3</Item>

而不是

<Synthetic Name="[channels]">
    <DisplayString>RGB</DisplayString>
</Synthetic>

答案 1 :(得分:0)

只需禁用Native Edit and Continue模式即可解决此问题

enter image description here