2using System.Collections.Generic;
6using System.Threading.Tasks;
29 public Valuemap(
int nChannels,
int nHeight,
int nWidth,
double[] rgData =
null)
31 int nSize = nChannels * nHeight * nWidth;
32 m_rgData = (rgData !=
null) ? rgData :
new double[nSize];
33 m_nChannels = nChannels;
36 m_nChannelOffset = nHeight * nWidth;
47 int nWidth = data.
Width;
49 int nSize = nChannels * nHeight * nWidth;
50 m_rgData =
new double[nSize];
51 m_nChannels = nChannels;
54 m_nChannelOffset = nHeight * nWidth;
56 Array.Copy(data.
Values, m_rgData, nSize);
65 public void SetPixel(
int nX,
int nY,
double clr)
67 int nIdx = nY * m_nWidth + nX;
72 m_rgData[nIdx + m_nChannelOffset] = clr;
73 m_rgData[nIdx + m_nChannelOffset * 2] = clr;
85 int nIdx = nY * m_nWidth + nX;
86 return m_rgData[nIdx];
96 public void SetPixel(
int nChannel,
int nX,
int nY,
double clr)
98 int nIdx = (nChannel * m_nChannelOffset) + nY * m_nWidth + nX;
109 public double GetPixel(
int nChannel,
int nX,
int nY)
111 int nIdx = (nChannel * m_nChannelOffset) + nY * m_nWidth + nX;
112 return m_rgData[nIdx];
121 for (
int i = 0; i < m_rgData.Length; i++)
132 public void SetAll(
int nChannel,
double dfVal)
134 int nIdxStart = m_nChannelOffset * nChannel;
135 int nCount = m_nChannelOffset;
137 for (
int i = nIdxStart; i < nIdxStart + nCount; i++)
148 Array.Clear(m_rgData, 0, m_rgData.Length);
156 get {
return m_rgData; }
164 get {
return m_nChannels; }
172 get {
return m_nHeight; }
180 get {
return m_nWidth; }
The Realmap operates similar to a bitmap but is actually just an array of doubles.
double[] Values
Specifies the data itself.
Valuemap(int nChannels, int nHeight, int nWidth, double[] rgData=null)
The constructor.
double GetPixel(int nX, int nY)
Get the value of a pixel in the map.
Valuemap(Valuemap data)
The constructorl
void SetPixel(int nChannel, int nX, int nY, double clr)
Set a given pixel to a given color.
void SetAll(double dfVal)
Set all values to the specified value.
void SetAll(int nChannel, double dfVal)
Set all values of a given channel to a specified value.
int Channels
Specifies the channels of the data.
void Clear()
Reset all values to zero.
double GetPixel(int nChannel, int nX, int nY)
Get the value of a pixel in the map.
void SetPixel(int nX, int nY, double clr)
Set a given pixel to a given color.
int Height
Specifies the height of the data.
int Width
Specifies the width of the data.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.